gpt4 book ai didi

javascript - 如何使用 ECharts 创建预测图表

转载 作者:行者123 更新时间:2023-12-01 16:10:48 26 4
gpt4 key购买 nike

我想用实际值(折线图)和预测值(虚线图)创建一个预测图。 Here是一个用 Excel 制作的例子:
enter image description here

我想使用 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'
}
}]

};

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

关于javascript - 如何使用 ECharts 创建预测图表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56842982/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com