plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.82k stars 1.85k forks source link

Date ticks on x axis have different format #4880

Open mizeljko opened 4 years ago

mizeljko commented 4 years ago

I have dates on x-axis and some of the ticks are in different format than others as they have month, day and year specified, and others just have time of day. When manually setting format of date, they overlap. Is it possible to have tick dates on x axis in the same format without overlapping?

Example without setting format:https://codepen.io/mizeljko/pen/RwWmONj Example with setting format and ticks overlapping: https://codepen.io/mizeljko/pen/vYNwwOv

alexcjohnson commented 4 years ago

Thanks for the report @mizeljko - it looks like our overlap avoidance system fails to account for multi-line labels.

The logic we use is that the second line is omitted if it's the same as the previous displayed second line. You can see that this happens even with a manual tickformat if you reverse the order of the lines in your second codepen: %Y-%m-%d\n%H:%M:%S -> %H:%M:%S\n%Y-%m-%d

So it seems to me there's one bug here: multiline labels overlapping when they're rotated (particularly when rotated 30 degrees)

And there's one feature request: disable the matching-second-line removal.