I want to create a forecast chart with Actual (a line chart) and projected values (a dotted chart). Here is an example made with Excel:
I want to create the same chart using the ECharts library but I couldn't find any example to use from their web page https://echarts.apache.org/examples/en/ :
It would be very helpful if there is an approach to build this chart using javascript, I don't mind using other libraries like ChartJs if they have this possibility.
try this.
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'
}
}]
};
It's a very simple example but it should solve your issue. I didn't add the legenda but you should be able to do thaat without any issues.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.