Currently, I am utilizing chart.js to generate a chart and everything is running smoothly. However, my goal is to assign a different color to the last bar of the bar chart. After checking the documentation provided by chart.js, I could not locate an option to alter the bar color dynamically.
Below is the snippet of my existing code:
var barChartData = { labels : livelabels,
datasets : [ { fillColor : "#E76E42",
strokeColor : "#C7754C",
data : livedata, } ] };
function showBarChart() {
var ctx = document.getElementById("barChartCanvas").getContext("2d");
var myBarChart = new Chart(ctx).Bar(barChartData,options);
}
$('#barChart').appear( function(){
$(this).css({ opacity: 1 });
setTimeout(showBarChart,300);
},{accX: 20, accY: -10},'easeInCubic');