我有一个使用echarts制作的图形图表。当我将鼠标悬停在边缘时,它将显示在强调选项上设置的某些行为。单击边缘之一时,有什么办法可以使这种行为发生?
强调代码:
emphasis: {
lineStyle: {
width: 5,
color: "#555555"
}
}
答案 0 :(得分:0)
myChart.on('click', (params) => {
if (params.dataType === 'edge') {
/* you can check params to look for what you want to pick */
myChart.dispatchAction({
/* HighLight type */
type: 'focusNodeAdjacency',
/* OffLight type if you need */
// type: 'unfocusNodeAdjacency',
/* Positioning the series with seriesId/seriesIndex/seriesName */
seriesIndex: 0,
/* Positioning the node with dataIndex */
dataIndex: params.dataIndex
});
}
})