Chartjs-Chart.js – add data to line chart from clicking pie chart segment

0👍

I managed to solve this issue my self by using the following code in the click function of the pie chart:

var activePoints = window.trackingPie2.getElementsAtEventForMode(evt, 'point', 
window.trackingPie1.options);
var firstPoint = activePoints[0];
var label = window.trackingPie2.data.labels[firstPoint._index];

I added “window.” to the call to the pie chart and used “getElementsAtEventForMode’ instead of “getElementAtEvent” to get pull in the data.

Leave a comment