candlesoyfrost
Posts: 3
Joined: Tue Oct 26, 2021 11:07 pm

Overlapping labels when using broken axis module

Hi,

I'm trying to remove weekends on a datetime chart, using the broken axis module. My current implementation works almost exactly as desired, however, the removed dates seem to be overlapped on top of the actual date. Is there something wrong with my implementation, or is this a bug?
How it appears on my machine:
preview.png
preview.png (33.73 KiB) Viewed 261 times
JSFiddle: https://stackblitz.com/edit/react-sujhi8

Thanks!
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Overlapping labels when using broken axis module

Hello candlesoyfrost,

Welcome to our forum and thanks for contacting us with your question!

I think you might have set wrong date range. In your initial config break takes place between 08-11-2018 and 10-11-2018 dates, which is thursday - saturday. I have slightly modified it and it seems to be working fine now.
Demo: https://stackblitz.com/edit/react-hdhdqj

Let me know if that was what you were looking for!
Best regards!
Mateusz Bernacik
Highcharts Developer
candlesoyfrost
Posts: 3
Joined: Tue Oct 26, 2021 11:07 pm

Re: Overlapping labels when using broken axis module

Hi,

Thank you for the help! It's true that the dates were incorrect, thank you for catching that.

However, I still see a couple of issues with the fixed demo. It looks like the correct days (Oct 2nd and Oct 3rd, UTC time) are not missing from the axis. Instead, Oct 4th and Oct 5th are collapsed together, leading to the same "overlapping" behavior described above:
preview2.png
preview2.png (137.6 KiB) Viewed 247 times
. Their associated data points also seem collapsed together, which is why there's a straight line at the beginning of each cycle, and why it seems impossible to hover over Oct 5th.
candlesoyfrost
Posts: 3
Joined: Tue Oct 26, 2021 11:07 pm

Re: Overlapping labels when using broken axis module

Ah, just to add, after some more playing around with the ranges:
I believe the original dates were actually correct. I believe some confusion arose because of how Javascript determines datetimes. From the documentation: https://developer.mozilla.org/en-US/doc ... s/Date/UTC, the "month" parameter is "An integer between 0 (January) and 11 (December) representing the month." So "2018, 11, 8" is actually 2018/12/8, which in UTC is Saturday.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Overlapping labels when using broken axis module

Hello candlesoyfrost,

You've made a really good point with that month order, of course you're right, sorry for that mistake. However, I still believe that date range should be slightly modified (please correct me if I'm wrong :D ) I think that from value shoud equal Date.UTC(2018, 11, 8) which is Saturday 12 2018 and to value should equal Date.UTC(2018, 11, 9) which is the following weekend day, Sunday 12 2018. Then all you need to do is specify break size. In this case I think that you might to set it to 1 day.
Demo: https://stackblitz.com/edit/react-ktcywj
API reference: https://api.highcharts.com/highcharts/x ... .breakSize

Let me know what do you think about that solution.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Usage”