vega-lite
vega-lite copied to clipboard
Adding monthly/daily/hourly/... as a shortcut for using time unit to round times
Our time unit's design optimize for selected parts of date/time values, which gives us ultimate flexibility.
However, one common case for using timeunit to round time, which can be pretty tedious as rounding to hourly buckets means users need to use the timeUnit yearmonthdatehours
, which is quite long to type (and can be error prone given year/month/date
are singular while hours
/minutes
are plural, following JS functions).
To make rounding time easier, I think we can consider adding the following shortcuts as a macro:
-
monthly
=yearmonth
-
daily
=yearmonthdate
-
hourly
=yearmonthdatehours
-
minutely
=yearmonthdatehoursminutes
(minutely is actually defined in MW dictionary) -
secondly
=yearmonthdatehoursminutesseconds
// This normally means, firstly, secondly, thirdly, so we may cut if you don't like it, but it's arguable we should add for consistency. -
millisecondly
=yearmonthdatehoursminutessecondsmilliseconds
// This is not defined in the dictionary, so we may cut if you don't like it, but it's arguable we should add for consistency. -
yearly
=year
-- for completeness
cc: @domoritz @arvind @jheer -- any opinions (esp. re: secondly and millisecondly)?