Use case: Timeseries with zooming/unknown X range.
Want to show only dates when I have data of multiple days (but the full timestamps in tooltips), and more fine grained x values if I have data only of a few hours, or I have zoomed.
Easiest solution would be have the axis.x.tick.format function take three arguments value, minValue, maxValue, with the latter specifying the currently shown X range.
Could you try axis.x.tick.fit = false? I guess this makes axis ticks to be shown flexibly as you want.
Sorry, I think I wasn't clear enough. What I want to achieve is to show the X axis ticks as YYYY-MM if I have data of a multiple years, then when I zoom in into the range of year, I want it to show as MM, then when I zoom into a single month I want it to show as DD, then when I zoom in I want it to show as HH:MM etc.
I.e. change the format of ticks based on the range of X values currently shown in the chart.
I see, but you cannot do it because format function is not called when zooming. I think you need to change tick text by yourself in onzoomend callback. You can get current zoom extent by zoom API, so it would be possible to calculate the current scale and generate proper tick text as you want.
Just saying that this would be really awesome to have built right in. I'm gonna try the zoom API though, thanks for the pointer.
This issue is related to #292
Please let me close.
How do you update tick values? (in the onzoom function)
Thanks
I was wondering if it's possible now out of box or should I use hack?
Most helpful comment
How do you update tick values? (in the onzoom function)
Thanks