繁体   English   中英

如何使用 ECharts 创建预测图表

[英]How to create Forecast Chart using ECharts

我想用实际(折线图)和投影值(点线图)创建预测图表。 是一个用Excel制作的例子: 在此处输入图片说明

我想使用 ECharts 库创建相同的图表,但在他们的网页https://echarts.apache.org/examples/en/ 中找不到任何示例:

如果有一种方法可以使用 javascript 构建此图表,那将非常有帮助,如果有这种可能性,我不介意使用其他库,例如 ChartJs。

尝试这个。

option = {
xAxis: {
    type: 'category',
    data: [20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
},
yAxis: {
    type: 'value'
},
series: [{
    data: [0, 20, 30, 45, 40, 50, 51, 52, 50, 49, 56, 55],
    type: 'line',
    smooth: true,
    lineStyle: {
        color: 'red'
    }
}, {
    data: [null, null, null, null, null, null, null, null, null, null, null, 55, 50, 49, 48],
    type: 'line',
    smooth: true,
    lineStyle: {
        color: 'blue',
        type: 'dashed'
    }
}]

};

这是一个非常简单的示例,但它应该可以解决您的问题。 我没有添加传奇,但你应该可以毫无问题地做到这一点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM