Commit 99b23238 by 王志慧

commit

1 parent 52cbc115
...@@ -40,19 +40,19 @@ Component({ ...@@ -40,19 +40,19 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
onInitChart(xData,yData) { onInitChart(xData, yData) {
this.ecComponent&&this.ecComponent.init((canvas, width, height, dpr) => { this.ecComponent && this.ecComponent.init((canvas, width, height, dpr) => {
const chart = echarts.init(canvas, null, { const chart = echarts.init(canvas, null, {
width: width, width: width,
height: height, height: height,
devicePixelRatio: dpr // new devicePixelRatio: dpr // new
}); });
this.setOption(chart,xData,yData); this.setOption(chart, xData, yData);
return chart; return chart;
}) })
}, },
setOption(chart,xData,yData) { setOption(chart, xData, yData) {
console.log(xData) let maxSpan = xData.length < 10 ? 50 : 20
var option = { var option = {
grid: { grid: {
left: 8, left: 8,
...@@ -125,7 +125,7 @@ Component({ ...@@ -125,7 +125,7 @@ Component({
}, },
dataZoom: { dataZoom: {
type: "inside", type: "inside",
maxSpan: xData.length<5?50:10 maxSpan:maxSpan
}, },
series: [{ series: [{
data: yData, data: yData,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!