echarts 散点图拟合曲线

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);
}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值