![](/img/trans.png)
[英]ECharts: change line color. i have pick 2 color .Both two color show like odd and even style
[英]ECharts: change line color
這是我的 EChart 初始化代碼:
var option = {
tooltip : {
trigger: 'axis'
},
calculable : true,
xAxis : [
{
type : 'category',
boundaryGap : false,
data : cat
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'Series 1',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:val
}
]
};
該行顯示為區域(正確)並以紅色着色(我認為默認情況下,我沒有在代碼中添加任何內容)。 如何更改圖表線條的顏色?
我試過
itemStyle: {normal: {areaStyle: {type: 'default'}}, color: '#d5ceeb'},
但它不起作用。
您正在 itemStyle 內寫入顏色,它會更改數據點的顏色,而不是線條。 它應該寫在 lineStyle 中,以便更改線條顏色。
series : [
{
name:'Series 1',
type:'line',
smooth:true,
itemStyle: {normal: {areaStyle: {type: 'default'}}},
data:val
lineStyle: {color: '#d5ceeb'}
}
]
有關 lineStyle 的更多選項,請參閱此處
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.