I am using word-cloud2 with echarts:
Is there any option to add onclick to each word on echarts word-cloud2. My code is in js and is as follows:
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;
after your call to setOption add this:
chart.on('click', 'series.wordCloud', function (el) {
console.log(el);
// add your custom logic here
});