-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time scale extra/overlapping labels when ticks are not evenly divisible #3069
Comments
The code was changed in #3064. Could you check if its still happening? |
Indeed, just built the very latest and the issue is the same. |
It looks like the problem is caused by folowing code (also changed in #3064):
Problem is probably caused by The fix should be changing folowing row to something like this:
and you also dont need to add last tick separatelly (if not explicitly defined), so you can change (few rows bellow)
to
|
@PuniCZ Unfortunately your suggestion doesn't fix the problem - overlapping still occurs. |
pinging #2600 since it seems to be related. Let's try to get this fixed ASAP because the hack (setting a max on the x scale), is buggy as well. |
This bug appears fixed in 2.5.0: https://jsfiddle.net/8gw084p6/2/ |
@tredston that's good 😄 not sure what did it, but I also don't know why the left label is off the left edge of the chart 😖 |
Fairly confident it's only fixed for some label sizes/datasets. I'm able to reproduce locally on 2.5 with other label values. |
@MeoMix I'm still seeing the issue with 2.5 as well. My fix is to remove these 3 lines: Chart.js/src/scales/scale.time.js Lines 301 to 303 in 1ca0ffb
|
I played around with a fork where I did something very similar, but ultimately I ended up relying on the |
I still have this issue, @ankane How do I manually remove/override those 3 lines? |
@Evertvdw You clone the repo, remove them, and run: npm install
npm install -g gulp
gulp build The built files will be placed in the |
Closing as duplicate of #2774 since I think it's the same underlying issue that hasn't been fixed for all cases |
This may be related to #3051 , and it's kind of the opposite issue to #2964 and #3064 .
Essentially the problem is too many labels displayed on the right of the chart when using the time scale. From what I can see the issue is that when I have a number number of days that you'd generally get a label for every second day but I have an odd number of days I will get a label on every second day plus the last label, causing the second last and last labels to overlap (and thus be unsightly and unreadable).
https://jsfiddle.net/8gw084p6/
In the jsfiddle please adjust the width of the "result" pane a bit to see how the chart responds to the various widths. If it's wide enough to show a label for every 1 day it looks fine.
If it's narrow enough for a label every 5th day it's fine.
In between when the labels are shown at an angle then it looks ok because they don't overlap, however the last label often goes off the chart.
The text was updated successfully, but these errors were encountered: