Skip to contents

Plot yearly index time series with EMA trends (highcharts)

Usage

plot_idx(
  data,
  title = "Index Trend",
  subtitle = "Average across portfolio locations with EMA trend, 1990-2020 (mm)",
  label = NULL,
  rowheight = 280,
  ncol = 1,
  ...
)

Arguments

data

output of wc_trg_*, see examples

title

chart title

subtitle

chart subtitle

label

optional annotation

rowheight

Height in px.

ncol

how many columns in the grid

...

Arguments passed on to hc_themed

hc

a highchart object

base_font

default font for all chart elements

axes

show axes (default: TRUE)

exporting

include chart export menu (default: TRUE)

credits

include credits (default: FALSE)

Examples

dt <- data.table(
 loc_id = 1:3,
 period = rep(c("prd_1", "prd_5"), 3),
 year = rep(1990:2020, each=3*2),
 idx = rnorm(31*3*2, 10),
 idx_lo = 8,
 idx_hi = 12,
 ecc = rnorm(31*3*2, .5)
)
#> Error in data.table(loc_id = 1:3, period = rep(c("prd_1", "prd_5"), 3),     year = rep(1990:2020, each = 3 * 2), idx = rnorm(31 * 3 *         2, 10), idx_lo = 8, idx_hi = 12, ecc = rnorm(31 * 3 *         2, 0.5)): could not find function "data.table"
plot_idx(dt)
#> Error in .(idx = mean(idx, na.rm = T), sd = sd(idx, na.rm = T), idx_lo = round(mean(idx_lo,     na.rm = T)), idx_hi = round(mean(idx_hi, na.rm = T)), ecc = mean(ecc,     na.rm = T)): could not find function "."