Numeric or date-time observations with optional rolling summaries and a secondary value axis. Uses LineSeriesOption and CartesianAxisOption from ECharts src/chart/line and src/coord/cartesian. Rolling windows count sorted observations, not elapsed time; incomplete windows and windows containing missing values remain missing. Even centered windows favor following values, matching data.table's centered alignment used by rtemis.
Usage
TimeSeriesConfig(
dat_path = NULL,
title = NULL,
origin = NULL,
writer = NULL,
legend_position = "top",
legend_placement = "outside",
x = NULL,
y = NULL,
group = NULL,
xlab = NULL,
ylab = NULL,
palette = NULL,
zoom = FALSE,
x2 = NULL,
zt = NULL,
shade_bin = NULL,
show_zt_every = 1L,
y2 = NULL,
y2lab = NULL,
window = 7L,
roll_fn = "none",
align = "center",
roll_width = 2,
roll_color = NULL,
raw_opacity = 0.5,
points = TRUE
)Arguments
- dat_path
Optional Character: Path to the data, read at draw time. The serializable alternative to passing
datatodraw().- title
Optional Character: Chart title. Declared here because it is the one property every chart type has;
paletteis not (four take acolormapinstead), and axis labels and margins are cartesian-only.- origin
Optional Named character {"user", "default", "derived"}: Where each value came from, one entry per settable property. Absent on an authored config; written by the interface that resolved it.
- writer
Optional Named character: Which interface wrote the config, as
nameandversion. Absent on an authored config.- legend_position
Character {"top", "bottom", "left", "right", "top-left", "top-right", "bottom-left", "bottom-right"}: Legend anchor. Top/bottom anchors use horizontal rows; left/right anchors use a vertical column. Corner anchors align within the top or bottom row.
- legend_placement
Character {"outside", "inside"}: Relation to the plotting area. Outside placement reserves space for the complete legend; inside placement overlays the data. Neither setting adds a missing legend.
- x, y
Optional Character: Time and value column bindings. Multiple y columns share x; group splits a single y column.
- group
Optional Character: Group column binding.
- xlab, ylab
Optional Character: Axis labels.
NULLderives them from the data.- palette
Optional Character: Series colors, overriding the theme palette for this chart.
NULLuses the theme's.- zoom
Logical: Enable the zoom control.
- x2, y2
Optional Character: Secondary time/value bindings. Unset x2 uses x.
- zt, shade_bin
Optional Character: Columns of zeitgeber labels and zero/one shading flags.
- show_zt_every
Integer
[1, Inf): Zeitgeber label stride; phase zero remains visible.- y2lab
Optional Character: Secondary axis name.
- window
Integer
[1, Inf): Number of observations per rolling window.- roll_fn
Character
{"none", "mean", "median", "min", "max", "sum"}: Summary.- align
Character
{"center", "left", "right"}: Window alignment.- roll_width
Numeric
(0, Inf): Rolling line width in pixels.- roll_color
Optional Character: Rolling line color; unset uses the group color.
- raw_opacity
Numeric
[0, 1]: Raw observation opacity.- points
Logical: Show raw points; FALSE draws raw lines.
Examples
setup_TimeSeriesConfig(x = "day", y = "value", window = 3L)#> <rtemis.draw::TimeSeriesConfig>
#> @ type : chr "timeseries"
#> @ dat_path : NULL
#> @ title : NULL
#> @ origin : Named chr [1:24] "default" "default" "default" "default" "user" ...
#> .. - attr(*, "names")= chr [1:24] "dat_path" "title" "legend_position" "legend_placement" ...
#> @ writer : NULL
#> @ legend_position : chr "top"
#> @ legend_placement: chr "outside"
#> @ x : chr "day"
#> @ y : chr "value"
#> @ group : NULL
#> @ xlab : NULL
#> @ ylab : NULL
#> @ palette : NULL
#> @ zoom : logi FALSE
#> @ x2 : NULL
#> @ zt : NULL
#> @ shade_bin : NULL
#> @ show_zt_every : int 1
#> @ y2 : NULL
#> @ y2lab : NULL
#> @ window : int 3
#> @ roll_fn : chr "none"
#> @ align : chr "center"
#> @ roll_width : num 2
#> @ roll_color : NULL
#> @ raw_opacity : num 0.5
#> @ points : logi TRUE