Utility functions for timeseries data, i.e. List (Time.Posix, Float)
.
In particular, functions for normalizing (removing gaps) and aggregating data
over time intervals.
Time interval types and operations provided by justinmimbs/time-extra
The groupByIntervals function is used internally to prepare data series for a columns chart, and groupByIntervalsMultiple is used internally for columnsFacets charts with fixed X scales.
These may be generally useful, for example if you want to pre-aggregate your data by time interval for line and lineFacets charts (which do not automatically use these functions).
List Observation
Representation of a time series
( Time.Posix, Basics.Float )
Representation of a single observation in a time series
intervalExtent : Time.Extra.Interval -> Time.Zone -> Series -> Maybe ( Time.Posix, Time.Posix )
Calculate the extent of a time series when grouped by the given interval. Note the lower bound is "rounded down" and the upper bound is "rounded up".
intervalExtentMultiple : Time.Extra.Interval -> Time.Zone -> List Series -> Maybe ( Time.Posix, Time.Posix )
Calculate the extent of multiple time series when grouped by the given interval, where the lower bound is the earliest time interval across all series and the higher bound is the latest time interval across all series. Note the lower bound is "rounded down" and the upper bound is "rounded up".
groupByIntervals : (List Basics.Float -> Basics.Float) -> Time.Extra.Interval -> Time.Zone -> Series -> Series
Group series by given time interval, aggregating y values by given function, and normalizing the series such that missing observations for time intervals are set to y = 0.
groupByIntervalsMultiple : (List Basics.Float -> Basics.Float) -> Time.Extra.Interval -> Time.Zone -> List Series -> List Series
Group multiple series by given time interval, aggregating y values by given function, and normalizing all series such that they all have the same extent and missing observations for time intervals in each series are set to y = 0.
groupByIntervalsInExtent : (List Basics.Float -> Basics.Float) -> Time.Extra.Interval -> Time.Zone -> ( Time.Posix, Time.Posix ) -> Series -> Series
Group series by given time interval and extent, aggregating y values by given function, and normalizing the series such that missing observations for time intervals are set to y = 0.