Chartjs-Chart.js: Updating chart shows wrong time format for a while

0👍

If I understand, I think what you’ll want to do is to set the following displayFormats explicitly.

displayFormats: {
  millisecond: "HH:mm:ss",
  second: "HH:mm:ss",
  minute: "HH:mm:ss",
  hour: "HH:mm:ss",
  day: "MM-dd HH:mm:ss",
  week: "MM-dd HH:mm:ss",
  month: "MM-dd HH:mm:ss",
  quarter: "MM-dd HH:mm:ss",
  year: "yyyy-MM-dd HH:mm:ss"
}

That way, when the X-axis is on millisecond resolution, it will display HH:mm:ss. I’ve left a couple of the buckets set to different display styles to demonstrate how you can adjust the format as the resolution of the X-axis changes.

Leave a comment