Skip to content

Wrong year assigned to a ticklabel in plotly.js #6457

@pedrogarcia1965

Description

@pedrogarcia1965

The following image contains a part of a scatter plot generated with plotly.js:

image

The red arrow shows the wrong value in ticklabel. It should be 53 2020.

If a zoom is made, then the right ticklabels are obtained:

image

This problem appears just when the ticklabel is generated when date is December 31st of any year.

One attention calling point is that the value of showed data in the first image when the mouse is over the point (following the green arrow), is the right one: 53, 2020!

The code for this issue can be found at: codepen

After a little research, a possible cause of issue could be related to:

  • Plotly uses Date.getUTCFullyear to calculate ticklabels,

  • For a date given on December 31st, the result may be different according to getUTCFullYear in MDN.

??

Or, is there any other cause producing this issue?

Please, can anyone help to solve it? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions