Control area color in line area chart?
问题简述 (One-line summary)
Is there a way to control the area color under a line chart or stacked line chart, horizontally?
版本及环境 (Version & Environment)
- ECharts 版本 (ECharts version):
- 浏览器类型和版本 (Browser version):
- 操作系统类型和版本 (OS Version):
重现步骤 (Steps to reproduce)
- The option below creates a chart that looks like this:

- How can I control the colors of the area along the xAxis (horizontal)? For example, I want blue on the left side, and then red on the right side above a certain x value. I cannot find a way to do this at all. I do see the dataRange feature, which would work for me, except it will only let me change the colors vertically along the yAxis like this for example:

I need a way of changing the colors in the other direction, from left to right along the xAxis, not the yAxis.
Thanks for any ideas!
期望结果 (Expected behaviour)
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
let options = {
tooltip : {
trigger: 'axis'
},
legend: {
data:['Orders','Ghost Orders']
},
xAxis : [
{
type : 'value',
scale: true
}
],
yAxis : [
{
type : 'value',
scale: true
}
],
series : [
{
name:'Orders',
type:'line',
stack: 'group1',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data: [
[
0.0189,
45
],
[
0.019,
96
],
[
0.0191,
85
],
[
0.0192,
50
],
[
0.0193,
2
],
[
0.0194,
14
],
[
0.0195,
79
]
]
},
{
name:'Ghost Orders',
type:'line',
stack: 'group2',
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:[
[
0.0189,
26
],
[
0.019,
33
],
[
0.0191,
58
],
[
0.019200000000000002,
45
],
[
0.0193,
94
],
[
0.0194,
30
],
[
0.0195,
52
]
]
}
]
};
其他信息 (Other comments)
you can use visualMap , look at the echarts document for detail .
you can use visualMap , look at the echarts document for detail . http://echarts.baidu.com/option.html#visualMap
Yes you can use visualMap( in the older version it is called dataRange). To change the direction you can set dimension property of visualMap to 0, which means it will encode the color of x value.