var setoption = { title: {}, legend: { show: this.legendshow, data: [this.legend] }, color: ['#ff960f'], toolbox: { show: this.showtoolbox, feature: { dataZoom: {}, magicType: { type: ["line", "bar"] }, restore: {}, saveAsImage: {} } }, xAxis: { data: this.$props.data.xdata, boundaryGap: boundarygap, axisTick: { show: false //隐藏Y轴刻度 }, axisLine: { show: false //隐藏Y轴线段 }, axisLabel: { textStyle: { color: "#2c3e50" } } }, grid: { left: 10, right: 10, bottom: this.bottom, top: this.top, containLabel: true }, tooltip: { trigger: "axis", axisPointer: { type: "line" } }, yAxis: { type: "value", axisLabel: { formatter: "{value} ", margin: 20, textStyle: { color: "#2c3e50" } }, axisTick: { show: false //隐藏Y轴刻度 }, axisLine: { show: false //隐藏Y轴线段 }, max: parseInt(max*1.4).toFixed(0) <=1?1:parseInt(max*1.4).toFixed(0) }, series: this.seriesinit(max) };
是yAxis的max小于1的时候导致报错 如图改成
parseInt(max*1.4).toFixed(0) <=1?1:parseInt(max*1.4).toFixed(0)