Commit 99b23238 by 王志慧

commit

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