score:1

Accepted answer

i think the variable chart is unknown in the scope of main.js. therefore, you would need to provide the chart variable to show_info like so:

// main.js
function show_info(my_object) { 

alert(my_object.data.labels[activeels[0].index]);
}

// other file
onclick: (evt, activeels, chart) => {
    show_info(chart);
    
},

Related Query

More Query from same tag