Commit ef685421 by 姜雷

修复储值视图数据少于4条时无法显示问题

parent 08a0d137
......@@ -244,11 +244,12 @@ export default {
updateSlider() {
this.sliderDom.innerHTML = '';
const arrLength = this.data.length;
console.log('2222', this.data.length - 1);
const arrLength = this.dataList.length;
let start = this.dataList.length - 4 >= 0 ? this.dataList.length - 4 : 0;
let end = this.dataList.length - 1 >= 1 ? this.dataList.length - 1 : 1;
// console.log('2222', this.dataList.length - 1, start, end);
if (arrLength) {
// let spanNum = 4 / arrLength;
this.slider = new Slider({
container: this.sliderDom,
width: 26,
......@@ -266,8 +267,8 @@ export default {
},
},
},
start: this.data.length - 4,
end: this.data.length - 1,
start: start,
end: end,
minSpan: 4,
maxSpan: 4,
data: this.dataList,
......@@ -291,16 +292,18 @@ export default {
if (this.chart) {
const arrLength = this.data.length;
let spanNum = 4 / arrLength;
let start =
this.dataList.length - 4 >= 0 ? this.dataList.length - 4 : 0;
let end = this.dataList.length - 1 >= 1 ? this.dataList.length - 1 : 1;
this.ds.setState('start', this.data.length - 4);
this.ds.setState('end', this.data.length - 1);
this.ds.setState('start', start);
this.ds.setState('end', end);
this.dv.source(this.dataList);
// let height = this.data.length * 50;
// this.chart.changeHeight(height);
this.updateSlider();
this.updateData();
console.log(this.chart.getYScales());
} else {
this.initData();
this.initSlider();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment