echarts 散点图拟合曲线

8,781次阅读
没有评论

共计 2221 个字符,预计需要花费 6 分钟才能阅读完成。

echarts 版本需 5 以上,vue 安装 ecStat,js 需引入 ecStat.js

echarts.registerTransform(ecStat.transform.regression);

var ehart001 = echarts.init(echart001);
var option001 ={
  dataset: [
    {
      source: [[2.0,771.0], [1.0,760.0], [1.0,772.0], [1.0,766.0], [2.0,763.0], [2.0,778.0], [2.0,761.0], [1.0,820.0], [1.0,755.0], [1.0,783.0], [1.0,736.0], [1.0,744.0], [1.0,745.0], [1.0,754.0], [2.0,739.0], [2.0,766.0], [2.0,757.0], [2.0,753.0], [1.0,801.0], [2.0,777.0], [3.0,778.0], [4.0,740.0], [5.0,780.0], [7.0,927.0], [8.0,1164.0], [12.0,774.0], [14.0,776.0], [16.0,770.0], [17.0,811.0], [19.0,933.0], [21.0,1099.0], [24.0,1218.0], [27.0,1292.0], [29.0,1327.0], [30.0,1364.0], [26.0,900.0], [23.0,825.0], [16.0,803.0], [9.0,767.0], [7.0,753.0], [5.0,749.0], [4.0,703.0], [5.0,770.0], [6.0,774.0], [6.0,783.0], [6.0,754.0], [7.0,788.0], [7.0,779.0], [7.0,716.0], [7.0,761.0], [8.0,725.0], [8.0,751.0], [9.0,663.0], [11.0,769.0], [8.0,753.0], [6.0,753.0], [5.0,751.0], [4.0,753.0], [3.0,751.0], [3.0,837.0], [5.0,782.0], [8.0,788.0], [11.0,933.0], [13.0,1102.0], [15.0,1246.0], [18.0,1388.0], [19.0,1431.0], [20.0,1349.0], [19.0,1177.0], [18.0,728.0], [18.0,734.0], [16.0,732.0], [13.0,765.0], [12.0,936.0], [13.0,1172.0], [16.0,1432.0], [20.0,1675.0], [24.0,1551.0], [25.0,712.0], [25.0,1179.0], [26.0,1325.0], [29.0,1465.0], [33.0,1599.0], [38.0,1756.0], [37.0,1612.0], [36.0,1591.0], [36.0,1566.0], [35.0,1554.0]]
    },
    {
      transform: {
        type: ‘ecStat:regression’,
        config: {method: ‘polynomial’, order: 3}
      }
    }
  ],
 
         title:{
           text:””,
           top:10,
           x: ‘center’,
           y: ‘center’,
       },
        grid: {
          top: “10%”,
          right: ‘20%’,
        },
  xAxis: {
    name:”,
    data:null,
    nameLocation:’center’,
    nameGap:30,
    axisTick: {
      alignWithLabel: true,
    },
    splitLine: {
      lineStyle: {
        type: ‘dashed’
      }
    }
  },
  yAxis: {
    splitLine: {
      lineStyle: {
        type: ‘dashed’
      }
    },
    name:”,
    nameLocation:’center’,
    nameGap:30,
    axisTick: {
      alignWithLabel: true,
    },
  },
  series: [
    {
      name: ‘scatter’,
      type: ‘scatter’,
      datasetIndex: 0,
       animation: false,
    },
    {
      name: ‘line’,
      type: ‘line’,
      smooth: true,
      datasetIndex: 1,
      symbolSize: 0.1,
      symbol: ‘circle’,
      label: {show: true, fontSize: 16},
      labelLayout: {dx: -20},
      encode: {label: 2, tooltip: 1},
       animation: false,
    }
  ],
  progressive:0
};
;
if(option001 !=null){
ehart001.setOption(option001);
}
 

原文地址: echarts 散点图拟合曲线

    正文完
     0
    Yojack
    版权声明:本篇文章由 Yojack 于2024-10-29发表,共计2221字。
    转载说明:
    1 本网站名称:优杰开发笔记
    2 本站永久网址:https://yojack.cn
    3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
    4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
    5 本站所有内容均可转载及分享, 但请注明出处
    6 我们始终尊重原创作者的版权,所有文章在发布时,均尽可能注明出处与作者。
    7 站长邮箱:laylwenl@gmail.com
    评论(没有评论)