Chartjs-Have the time on x axes to show the last 24 hours from current time

0👍

You’ve added a wrong value to the ‘max’ config at scales. Change it to

max: labels[labels.length - 1]

0👍

Unless until your Data is an array of new Date() format, Chartjs can’t interpret data to create intervals or set min and max. I had the same issue. Only way , I was able to fix is by adding new Date() before time . If you don’t have dates and as it is past 24 hour data, Prepare data array by adding current date and yesterdays date.

Leave a comment