I have a chart and when clicked on each chart label the scroll move to their respective section in HTML. I'm using Chart.js, The only action I could do when I click the label is an alert.
Javascript
// Chart
var barData = {
labels: ['Red', 'Orange', 'Yellow', 'Green']
};
var pieData = [{
value: 40,
color: "#ad1f27",
highlight: "#ad474c",
label: "Red"
}, {
value: 40,
color: "#c26828",
highlight: "#c27e4d",
label: "Orange"
}, {
value: 10,
color: "#c3b830",
highlight: "#c3bc6b",
label: "Yellow"
}, {
value: 10,
color: "#14773c",
highlight: "#2da15b",
label: "Green"
}];
var options = {
segmentShowStroke: false
};
Chart.defaults.global.responsive = true;
var context = document.getElementById('chartDonnut').getContext('2d');
var skillsChart = new Chart(context).Doughnut(pieData, options);
$("#chartDonnut").click(function(evt) {
var activePoints = skillsChart.getSegmentsAtEvent(evt);
var url = activePoints[0].label + activePoints[0].value + activePoints[0].x + activePoints[0].y;
alert(url);
});