hc_responsive {highcharter}R Documentation

Setting responsive options to highchart objects

Description

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

Usage

hc_responsive(hc, ...)

Arguments

hc

A highchart htmlwidget object.

...

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

Examples


leg_500_opts <- list(enabled = FALSE)
leg_900_opts <- list(align = "right", verticalAlign = "middle",  layout = "vertical")

highcharts_demo() %>% 
  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)
      )
    )
  )
             

[Package highcharter version 0.7.0 Index]