How Echarts add a mouse click event? Click the trigger to prevent duplication event

How Echarts add a mouse click event?

1. Typically we only use the following code, and display the graph by using the configuration data.

    echarts.init myChart = var (document.getElementById ( 'chartBox'));
    var Option = {...};
    myChart.setOption (Option);

2. Add the following code after myChart.setOption (option), to trigger each item icon mouse click event.

    myChart.on ( 'the Click', function (param) {
        // this params can get you to click on the figure of the current parameter entry
        console.dir (param)
    });    

Note: Mouse events include 'click', ' dblclick ',' mousedown ',' mouseup ',' mouseover ',' mouseout ',' globalout ',' contextmenu '.

3. If you need to clear before logic operation, the second point of the code is executed multiple times, then bind binding:

    // prevent duplicate trigger a click event
    IF (myChart ._ $ handlers.click) {
        myChart ._ $ = 0 handlers.click.length;
    }
    myChart.on ( '
        // This parameter params can get you a pie chart in the current click the item
        _this.showMapPointInfo (params, param);
    });

Guess you like

Origin www.cnblogs.com/popo1/p/11502334.html