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.

Incorrect automatic date labels on X axis

See original GitHub issue

Data is provided from Apr 7 to Apr 22:

image

The very first X-label says Apr 8. Expected: Apr 9 (3rd day starting from Apr 7).

The conflict also can be clearly seen when mouse-hovering the corresponding data point:

image


Data for bug reproduction

Days (X axis):

["2016-04-07","2016-04-08","2016-04-09","2016-04-10","2016-04-11","2016-04-12","2016-04-13","2016-04-14","2016-04-15","2016-04-16","2016-04-17","2016-04-18","2016-04-19","2016-04-20","2016-04-21","2016-04-22"]

Number of responses (Y axis):

[1,0,0,0,0,0,0,0,1,0,0,2,0,0,0,6]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
etpinardcommented, Apr 28, 2016

If you zoom in on that point, you’ll see that the label and data point aren’t exactly at the same location. They should be a few hours apart, one on April 8, one on April 9.

0reactions
alexcjohnsoncommented, Jun 22, 2018

@analytics-bootcamp you’re right, that’s not a timezone issue. The issue there is that we automatically put the label “Aug 2018” at August 1, which is essentially at your bar for July 31. The ticks are not labeling the bars, though in this case they’re very close to the bars, they’re labeling axis positions.

You can force the behavior you want with eg:

Plotly.relayout(gd,{
    'xaxis.tick0':'2000-01-31', // canonical tick on the last day of the month
                                // (which automatically sets tickmode: 'linear')
    'xaxis.dtick':'M1', // can't use auto ticks with tick0, so you have to specify 1-month ticks
    'xaxis.tickformat':'%b %Y' // eg 'Jul 2018', otherwise we'll show 'Jul 31'
                               // (and year when necessary)
})

I’m not really sure how we could figure out automatically that this is what you want though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date Axis in Excel Chart is wrong - AuditExcel
If you right click on the horizontal axis and choose to Format Axis, you will see that under Axis Type it has 3...
Read more >
X-axis showing wrong date - Microsoft Community Hub
It appears you are using a scatter plot which I normally recommend and/or is the solution to why something isn't working for someone...
Read more >
Horizontal date axis incorrect on Excel line chart with ...
To check, in the Select Data Source dialogue for your chart, click on series 1 in the legend Entries (Series) on the left...
Read more >
Excel axis shows wrong date- start of month or large gaps in ...
Date Axis in Excel Chart is wrong If you right click on the horizontal axis and choose to Format Axis, you will see...
Read more >
Date/Time label is shown in wrong value on X-Axis - Highcharts
Re: Date/Time label is shown in wrong value on X-Axis ... Hi, I think that this is normal functionality when you are adding...
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