1.显示轴线
xAxis: {
axisLine: { // 显示轴线
show: true,
onZero: false,
lineStyle: {
color: '#ffffff'
}
},
},
2.点击legend
legendClick(myChart, legendData)
option && myChart.setOption(option, true)
legendClick(chart, legendData) {
chart.off('legendselectchanged')
// 定义当前点击的标签
let legendWai = ''
chart.on('legendselectchanged', function(obj) {
legendWai = obj.name
for (let i = 0; i < legendData.length; i++) {
// 显示当前legend 关闭非当前legent
if (legendWai == legendData[i]) {
chart.dispatchAction({
type: 'legendSelect',
name: legendData[i]
})
} else {
chart.dispatchAction({
type: 'legendUnSelect',
name: legendData[i]
})
}
}
})
}