Using unit: 'month' for time axis should be ok whatever the data.
If the intervals between data points are too short, using unit: 'month' leads to unusable chart.
Fiddle that reproduces the issue: https://jsfiddle.net/7ce1afx4/
If we remove unit: 'month', the issue is gone.
If in generateDate we add "* 30" to generate monthly points instead of daily points, the issue is gone too.
I encountered this issue after migrating to 3.0.0-alpha, I think this is a regression because I never saw this with 2.9.
There's a single tick generated for March 1, 2020. The min is March 21, 2020 and the max is March 31, 2020. It sort of seems right to me that if you have unit: 'month' and a min and max that don't span a month boundary that you end up with no ticks. If you simply remove unit: 'month' then it'll pick the unit for you as 'day' and you get a chart more like one might expect.
It's not really clear to me how else you might expect this to work other than how it works now. I suppose we could figure out that unit: 'month' has no ticks insides the min and max bounds and then change the unit for you, but I'm not sure I like the idea of ignoring or overriding user-specified values. If you want us to figure out the appropriate unit then it seems like the best thing to do is just not specify the unit
Thank you for you answer.
Same fiddle slightly modified with 2.9.3: https://jsfiddle.net/e9x4cq31/
Not perfect because there is no ticks displayed under the axis, but at least the data is displayed correctly.
I need to do this because I have an irregular stream of data coming with intervals between points that can be days or months, and I would want minor ticks to be months and major ticks to be years even at the begining of the stream when the first points are only some days. In this case I would want only one tick displayed with the beginning month.
BTW the main issue for me is not that there is no ticks, but the rendering issues (cropped chart, reversed points, no tooltips, no interactions, line not filled, etc.) that do not exist in 2.9.3.
Ah, I see. Thanks for the added details. The fiddle helps a lot in showing what's changed. Thank you for putting that together
It seems like filterBetween isn't working because buildTicks should return no ticks
I sent a fix here that makes your sample work: https://github.com/chartjs/Chart.js/pull/7211
Thanks for the bug report and trying out the alpha!
I want to thanks you and all the Chart.js maintainers for your great work, this alpha fixes many long standing bugs I had with 2.x and already seems pretty stable!
Most helpful comment
I want to thanks you and all the Chart.js maintainers for your great work, this alpha fixes many long standing bugs I had with 2.x and already seems pretty stable!