Enhance the DateTime
, Date
and Time
axis formatting
#4404
Labels
enhancement
Feature requests and enhancements
Makie
Backend independent issues (Makie core)
planning
For discussion and planning development
units
aka dim converts
Feature description
Extend the handling of
TimeType
type for axis ticks and labels by handlingDate
andTime
and enable the use of a formatter specified as aDateFormat
or anyFunction
on ticks' valuesHere are three light modifications in
src/date-integration.jl
of v0.21.11, enabling those:1. Add easy to define formatter with
DateFormat
In
src/date-integration.jl
add the followingget_ticklabels
functions:2. Extend
get_ticks
forDateTimeConversion
to use PlotUtilsjl functionoptimize_datetime_ticks
forDate
beyondDateTime
. And use theDateFormat
formatter or any formatter defined by aFunction
on ticks' values.Add to function
get_ticks(conversion::DateTimeConversion, args...)
A conversion of extrema values to DateTime corresponding values
And at the end of the corresponding
if
clause, before returning, either convert back ticks values computed byoptimize_datetime_ticks
to the axis unit and use theDateFormat
type formatter or useFunction
type formatter on internal numbers ticks' values:3. Handle the
Time
type inget_ticks
forDateTimeConversion
by using theDateFormat
formatter (with its restriction of not handling precision below the milisecond) or any formatter defined by aFunction
on ticks' valuesOutput plot examples
This should enable to produce this type of
Date
,DateTime
andTime
axis formatting withAutomatic
,DateFormat
orFunction
formatter.By the way, it would be interesting to document a bit theI had not seen the docstrings, maybe a mention to it in documentation thennumber_to_date
functions, even if not exported, with a docstring. It would ease the use of theFunction
formatted.Examples code
Further enhancement
It would be great to have a default (
Automatic
?) well behaved Date, Time, DateTime formatter like the one in Plotly.jsThe text was updated successfully, but these errors were encountered: