我有一个包含一系列数据的echarts条形图。单击某个栏时,会对其应用强调。有没有一种方法可以以编程方式选择条形图中的系列之一以在图表加载时强调?
我的条形图选项代码:
options = {
markPoint: { data: ['Q1'] },
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['Q1', 'Q2', 'Q3', 'Q4'],
axisTick: {
alignWithLabel: true,
}
}
],
yAxis: [{
type: 'value'
}],
series: [{
name: 'Counters',
type: 'bar',
barWidth: '50%',
data: [3,8,12,5],
itemStyle: {
//highlight
emphasis: {
barBorderColor: 'red',
barBorderWidth: 2
}
}
}]
};
Run Code Online (Sandbox Code Playgroud)
谢谢。