How can echart directly use js code to trigger click events bound with on

click method is bound with on in echart

then I want to use js code to trigger the click method. There is no corresponding explanation for the official api. I want to know if there is a way to ask the Great God for advice

Mar.28,2021

bind event handlers.

There are two types of events in

ECharts, one is a mouse event, which is triggered when a mouse clicks on a graph, and the other is an event triggered after a call to dispatchAction. Each action has a corresponding event, as detailed in the documentation for action and events.

< hr >

these are the original words of the official document. I personally feel that I have misunderstood it. Now that you've bound the click event. Although your event is in response to a mouse click, not triggered actively.

of course, if you want to trigger actively, call dispatchAction. Specific modification method:
1. This is how you should have written
yourMapInstance.on ('click', function (params) {

)
doSomething(params);

});

  1. optionally enter the event you want to trigger to match the other parameters of action, in dispatchAction.

dispatchAction ({

)
type: 'highlight'//action

})

  1. reference:

http://echarts.baidu.com/api.

Menu