Chartjs-Chart.js manage the height of the graph to match the data

0👍

We can acheive this by getting height of the page and mulitplying the barpercentage with no of the labels. It will get us percentage which we can convert to px with help of height and then set that height to parent container of canvas.

var h = $('body').height() * ((1 * data.labels.length)/100);
t.section.find("#"+target).parent().height(h)

Leave a comment