我用的是word-cloud2 2和echarts:
有没有任何选项可以添加onclick到echarts上的每一个单词上,word-cloud2 2。我的代码在js中,如下所示:
var chart = echarts.init(document.getElementById('main'));
var option = {
tooltip: {},
series: [ {
type: 'wordCloud',
gridSize: 2,
sizeRange: [12, 50],
rotationRange: [-90, 90],
shape: 'apple',
width: 600,
height: 400,
tooltip: {
width: 0,
height: 0,
},
drawOutOfBound: true,
data: [
{
name: 'Machine Learning',
value: 10000,
},
]
} ]
};
chart.setOption(option);
window.onresize = chart.resize;发布于 2022-07-23 16:48:59
在调用setOption之后,添加以下内容:
chart.on('click', 'series.wordCloud', function (el) {
console.log(el);
// add your custom logic here
});https://stackoverflow.com/questions/73088750
复制相似问题