Open TheToddmeister opened 3 months ago
Thanks, I'm glad you like it.
Yes conditional ticks are possible! You can use f64::NAN
for this and the drawn line will stop and restart as expected.
This should probably be better documented with an example and as a type like Option<T>
. I've been reluctant to expand on the tick types but will need to to address #17
If i may add another issue to this thread. How would you implement an X tick where the X is (ordinate day, ordinate hour). So far I've just transformed it to current year datetime. Would an ordinate definition be possible?
Let me try and understand this: you want ticks generated such that they align only to a specific hour / day / month / etc? I'm guessing you want something specific rather than just letting the tick generator work out the best scale (day, hour, or minute, etc) and fit whatever it can in the space it has? It might be worthwhile sharing an example of what you're trying to achieve to clear this up.
What you're asking for should be possible as tick labels are separated into a generator and a formatter. The TickGen will find the right scale and number of ticks to show given a range and available space so that's probably what you want to tweak. The formatter is more useful for things like showing the date under the mouse in a tooltip when it's not aligned to a specific tick without diving into nanoseconds or perhaps different formats in different contexts (think tooltip vs tick labels). The documentation, with hidden types, doesn't look to be that clear here.
So changing the tick gen to only generate ticks for the day would be to use Timestamps::from_periods
and then you can pass it the list of Period
you want which could be limited to just Period::Day
. This then gets set in TickLabels::from_generator
I suppose there are no examples of this either :)
To review:
f64::NAN
in Ticks.Option<Tick>
to make f64::NAN
clearer.Apologies for disappearing: I just came back to looking at this now as it is connected to a hobby project github account. Thank you and I'll try that :)
Hey I really like this project! Is conditional ticks possible and or wanted? Is it within the wanted scope of the project? There is no implementation for a non-continous line that that i can see, but i would like to either make it or see it made(as i need it). Is it reasonable to make such an implementation?