我在lineStyle里面设置了线的颜色,但是我无法设置series[i]-line.symbol的颜色。symbol的颜色总是根据我的color中的颜色交替显示。如何保证symbol的颜色与线的颜色一致呢?
1.
2.
symbol可以设置成与line一样的颜色
var color = ['rgb(155,187,89)','#c23531']
option = {
title: {
text: '未来一周气温变化',
subtext: '纯属虚构'
},
color:color,
tooltip: {
trigger: 'axis'
},
legend: {
data:['最高气温','最低气温']
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
restore: {},
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一','周二','周三','周四','周五','周六','周日']
},
yAxis: {
type: 'value',
axisLabel: {
formatter: '{value} °C'
}
},
series: [
{
name:'最高气温',
type:'line',
symbol:'arrow',
symbolSize:10,
data:[11, 11, 15, 13, 12, 13, 10],
lineStyle: {
normal: {
color: color[0],
},
},
},
{
name:'最低气温',
type:'line',
symbol:'arrow',
symbolSize:10,
data:[1, -2, 2, 5, 3, 2, 0],
lineStyle: {
normal: {
color: color[0],
},
},
},
{
name:'最低气温',
type:'line',
symbol:'arrow',
symbolSize:10,
data:[5, 5,8, 9, 8, 9, 5],
lineStyle: {
normal: {
color: color[1],
},
},
}
]
};

我这个颜色可以设为一致吗?谢谢指教!
设置 itemStyle,不要设置 lineStyle
非常感谢,使用成功!
谢谢我也搞定了
Most helpful comment
设置 itemStyle,不要设置 lineStyle