Chartjs-Chart.js how to display max value?

1👍

JavaScript code

var maxVal = Math.max.apply(null, data) // 4
document.getElementById(“demo”).innerHTML = maxVal;

Html Code

MaxValue

you know already y-axis data, so using Math.max.apply function pass the y-axis data array into the function and find the maximum value in the array and store it in the variable finally display the element using either use DOM by id innerhtml or canvas object to display the element in the above graph. alignment using css

Leave a comment