当您单击pieChart nvd3的图例时发送事件

Dispatch event when you click in legend of pieChart nvd3

本文关键字:事件 单击 pieChart nvd3      更新时间:2023-09-26

当我点击pieChart nvd3的图例并获取值时,如何调度事件​​系列的(可见或不可见)?

如果您有:

var chart = nv.models.pieChart() 

这是捕捉事件的方法:

chart.dispatch.on ('stateChange', function (e) {myFunction (e)}); 

之后:

function myFunction (e) {
    var series = e.disabled; 
    //series is array with "true" or "false" value, this values
    //depending if the serie[i] is showing
    //more code here for processing
};