美文网首页
echarts回归分析

echarts回归分析

作者: Gino_Li | 来源:发表于2019-12-03 11:39 被阅读0次

安装

npm i echarts
npm i echarts-stat

调用

data() {
  return {
    myRegression: []
  }
},
computed: {
  return {
    trendLineOption() { //趋势分析
      return {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'line'
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          top: '2.5%',
          containLabel: true
        },
        xAxis: {
          type: 'category',
          data: this.lineXaxis,
          boundaryGap: false,
          axisLabel: {
            rotate: 40
          }
        },
        yAxis: {
          type: 'value'
        },
        series: [{
          data: this.lineData,
          type: 'line'
        }, {
          type: "line",
          showSymbol: false,
          lineStyle: {
            type: "dashed",
            color: "#999"
          },
          smooth: true,
          data: this.myRegression.points
        }]
      }
    }  
  }
}
methods: {
    // 回归分析
    ecStat() {
      this.myRegression = ecStat.regression('polynomial', this.trendData, 4);
      this.myRegression.points.sort((a, b) => {
        return a[0] - b[0];
      })
      console.log(this.myRegression);
    }
}

相关文章

网友评论

      本文标题:echarts回归分析

      本文链接:https://www.haomeiwen.com/subject/bllcgctx.html