My Purpose is i want to pass the bar label and value to another page on click, Here is my Chart JS code and how can i fulfill my purpose ?
var barCtx = document.getElementById("CHRTID");
var myBarChart = new Chart(barCtx, {
type: 'bar',
data: {
labels: [ JAN,FEB,MAR ],
datasets: [{
label: 'Order Entry by Date',
data: [10,25,95],
backgroundColor: [
'rgba(255, 99, 132, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 0.2)'
],
borderWidth: .25
}]
},
options: {
onClick: function(event) {
var activePoints = this.getBarsAtEvent(event);
var Values = activePoints[0].label + ' = ' + activePoints[0].value;
alert(Values);
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
});
Thanks in Advance.