echart Uncaught TypeError: Failed to execute 'createRadialGradient' on 'CanvasRenderingContext2D': The provided double value is non-finite.

      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)
posted @ 2019-12-18 15:11  海中松树  阅读(6001)  评论(0编辑  收藏  举报