hc_responsive: Responsive options for highcharter objects

Description Usage Arguments Examples

View source: R/highcharts-api.R

Description

Allows setting a set of rules to apply for different screen or chart sizes. Each rule specifies additional chart options.

Usage

1

Arguments

hc

A highchart htmlwidget object.

...

Arguments defined in https://api.highcharts.com/highcharts/responsive.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
leg_500_opts <- list(enabled = FALSE)
leg_900_opts <- list(align = "right", verticalAlign = "middle", layout = "vertical")


# change the with of the container/windows to see the effect
highchart() %>%
  hc_add_series(data = cumsum(rnorm(100))) %>%
  hc_responsive(
    rules = list(
      # remove legend if there is no much space
      list(
        condition = list(maxWidth = 500),
        chartOptions = list(legend = leg_500_opts)
      ),
      # put legend on the right when there is much space
      list(
        condition = list(minWidth = 900),
        chartOptions = list(legend = leg_900_opts)
      )
    )
  )

highcharter documentation built on Jan. 3, 2022, 5:08 p.m.