2 thoughts on “onclick events possible?

  1. From the two bars stacked side by side, can I get the handle on one? When I use getBarsAtEvent(), it gives me both the bars but I want the exact one that I clicked.
    Any idea?

  2. this is my fix :
    `
    var myChart = new Chart(ctx, config);
    $(“canvas#” + id).on(‘click’, function (e) {
    var bars = myChart.getElementAtEvent(e);
    if (bars.length == 0) return;

                var element = null;
                element = bars[0];
                if (element === null) return;
    
                var labelElement, dataElement;
                labelElement = config.data.datasets[element._datasetIndex].label;
                dataElement = config.data.datasets[element._datasetIndex].data[element._index];
    
            });
    

    `

Comments are closed.