question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

time in x axis displayed incorrectly

See original GitHub issue

Chart.js version : 2.4.0 Chart type: bar

   xAxes: [{
       stacked: true,
       gridLines: {
           display: false
       },
       position: 'bottom',
       type: 'time',
       time: {
           displayFormats: {
               day: 'MMM DD'
           },
           unit: 'day'
       },
       ticks: {
           stepSize: 0,
       }
   }]

Date array (X axes)

[2016-10-19T00:00:00Z,2016-10-20T00:00:00Z,2016-10-21T00:00:00Z,2016-10-22T00:00:00Z,2016-10-23T00:00:00Z,2016-10-24T00:00:00Z,2016-10-25T00:00:00Z,2016-10-26T00:00:00Z,2016-10-27T00:00:00Z,2016-10-28T00:00:00Z,2016-10-29T00:00:00Z,2016-10-30T00:00:00Z,2016-10-31T00:00:00Z,2016-11-01T00:00:00Z,2016-11-02T00:00:00Z,2016-11-03T00:00:00Z,2016-11-04T00:00:00Z,2016-11-05T00:00:00Z,2016-11-06T00:00:00Z,2016-11-07T00:00:00Z,2016-11-08T00:00:00Z,2016-11-09T00:00:00Z,2016-11-10T00:00:00Z,2016-11-11T00:00:00Z,2016-11-12T00:00:00Z,2016-11-13T00:00:00Z,2016-11-14T00:00:00Z,2016-11-15T00:00:00Z,2016-11-16T00:00:00Z,2016-11-17T00:00:00Z]

Value array (Y axes)

[1, 2, 0, 20, 0, 0, 39, 2, 1, 0, 0, 0, 1, 3, 4, 3, 2, 0, 3, 14, 44, 55, 1, 0, 1, 0, 0, 1, 0, 1]

Actual result: image

Issue: Date array gets left shifted with one value

When type and time keys are removed, it works as expected but, the results are displayed as is in the date array. The ISO -> MMM DD conversion is doing something weird.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dalehalliwellcommented, Nov 21, 2016

Experiencing the same issue as OP with time scale x-axis, labels are shifted to the left and some bars overlap image

1reaction
stefanfiskcommented, Nov 22, 2016

Here is a fiddle which reproduces the issue: http://jsfiddle.net/najcawjv/

Sorry for the weird code, it was a quick copy-paste-cleanup…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visuals displaying wrong time on X-axis
Hello all, So, today (or at least today is the day I noticed) for some reason, my graphs show the wrong date on...
Read more >
Incorrect date/time on response time graph x-axis
I'm looking at the response time graph for the last 7 days and if I hover the mouse over the charted line on...
Read more >
Incorrect Values on Horizontal Axis - Microsoft Community
The problem is probably due to Excel automatically setting your horizontal axis. In Chart Tools, select the Layout tab.
Read more >
Date Axis in Excel Chart is wrong - AuditExcel
You've built your chart, it all makes sense and suddenly you look at your horizontal axis, and the date axis is wrong. This...
Read more >
highstocks x-axis time incorrect - Stack Overflow
Your last datetime is 1416295440000 which is Nov 18, 7:24 !! Exactly as shown in the chart. Correct your data, and don't say...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found