v_specs_datazoom: Add data zoom to a chart

View source: R/specs.R

v_specs_datazoomR Documentation

Add data zoom to a chart

Description

Add data zoom to a chart

Usage

v_specs_datazoom(
  vc,
  start = "{label:%Y-%m-%d}",
  end = "{label:%Y-%m-%d}",
  ...,
  brush = TRUE
)

Arguments

vc

A chart created with vchart().

start, end

Formatter for the start/end label, e.g. : "Start: \{label:%Y-%m-%d\}", where the part between braces will be replaced by the date with the format specified.

...

Additional parameters for dataZoom property, see online documentation.

brush

Logical, add the ability to brush the chart to zoom in.

Value

A vchart() htmlwidget object.

Examples


library(vchartr)

data("economics", package = "ggplot2")
vchart(economics, aes(date, unemploy)) %>%
  v_line() %>%
  v_specs_datazoom()


co2_emissions %>%
  subset(country %in% c("China", "United States", "India")) %>%
  vchart() %>%
  v_line(aes(year, co2, color = country)) %>%
  v_specs_datazoom(start = "{label:.0f}", startValue = 1990, end = "{label:.0f}")

vchartr documentation built on April 12, 2025, 1:51 a.m.