chart.js Data length

32 views
Skip to first unread message

Tim Williams

unread,
Dec 20, 2022, 11:28:40 AM12/20/22
to Chart.js User Discussion
Thank you for looking and thank you for your help.

I'm pretty new to charts.js and I'm having issues with displaying all the values I'm putting into a gantt chart.  It has about 4K of lines, but when it gets down around halfway it squishes everything else together:
Capture.PNG

In the code, I'm using a subbox to stretch to the content length:
const subbox = document.querySelector('.subbox');
subbox.style.height = '800px';
if (myChart.data.labels.length > 38) {
    const newHeight = 800 + (myChart.data.labels.length * 20);
    subbox.style.height = `${newHeight}px`;
}

In the end the box is around 58K long.  Just testing to increase/decrease it manually causes issues.  I'm just trying to get the contents to display to the end of the chart.

I'm attaching the html page code in case you want to run it and see what the issue is.
test.html

Tim Williams

unread,
Dec 22, 2022, 8:31:52 AM12/22/22
to Chart.js User Discussion
I don't understand something.  If I change the value "(myChart.data.labels.length * 20);" from "20" to "10", everything displays, but the chart data is mis-aligned to the title values.
Reply all
Reply to author
Forward
0 new messages