| | |
| | | // datay: [120, 200, 150, 180, 170, 150, 130, 180, 140], |
| | | // datay2: [20, 30, 50, 40, 70, 50, 30, 80, 40], |
| | | // }, |
| | | startValue: 0, |
| | | endValue: 5, |
| | | chartTimer: null, |
| | | }; |
| | | }, |
| | | watch: { |
| | | "chartData.datay"(val) { |
| | | this.startValue = 0; |
| | | this.endValue = 5; |
| | | this.pieChart("chart", this.chartData); |
| | | }, |
| | | }, |
| | |
| | | type: "inside", |
| | | xAxisIndex: 0, |
| | | show: false, |
| | | startValue: 0, // 从头开始 |
| | | endValue: 5, // 一次性展示几个 |
| | | startValue: that.startValue, // 从头开始 |
| | | endValue: that.endValue, // 一次性展示几个 |
| | | }, |
| | | ], |
| | | legend: { |
| | |
| | | color: "#00FFFF", |
| | | }, |
| | | formatter: function (value) { |
| | | if (value.length > 5) { |
| | | return `${value.slice(0, 4)}...`; |
| | | if (value.length > 4) { |
| | | return `${value.slice(0, 3)}...`; |
| | | } |
| | | return value; |
| | | }, |
| | |
| | | this.chartTimer = setInterval(function () { |
| | | // 每次向左滑动一个,最后一个从头开始。 |
| | | if (option.dataZoom[0].endValue == that.chartData.datay.length) { |
| | | option.dataZoom[0].startValue = 0; |
| | | option.dataZoom[0].endValue = 5; |
| | | option.dataZoom[0].startValue = that.startValue; |
| | | option.dataZoom[0].endValue = that.endValue; |
| | | } else { |
| | | option.dataZoom[0].endValue = option.dataZoom[0].endValue + 1; |
| | | option.dataZoom[0].startValue = option.dataZoom[0].startValue + 1; |