Skip to contents

Add a pre-built highcharter chart to your dashboard. This allows you to create complex, customized highcharter visualizations and include them directly without using dashboardr's viz_* functions.

Usage

add_hc(
  content,
  hc_object,
  height = NULL,
  tabgroup = NULL,
  filter_vars = NULL,
  show_when = NULL
)

Arguments

content

A content_collection, page_object, or dashboard object

hc_object

A highcharter object created with highcharter::highchart() or hchart()

height

Optional height for the chart (e.g., "400px", "50vh"). If NULL (default), no height is set and highcharter handles its own sizing

tabgroup

Optional tabgroup for organizing content (character vector for nested tabs)

filter_vars

Optional character vector of input filter variables to apply to this block.

show_when

One-sided formula controlling conditional display based on input values.

Value

Updated content object

Examples

if (FALSE) { # \dontrun{
library(highcharter)

# Create a custom highcharter chart
my_chart <- hchart(mtcars, "scatter", hcaes(x = wt, y = mpg, group = cyl)) %>%
  hc_title(text = "Custom Scatter Plot") %>%
  hc_subtitle(text = "Made with highcharter") %>%
  hc_add_theme(hc_theme_smpl())

# Add it to a page
page <- create_page("Charts") %>%
  add_hc(my_chart) %>%
  add_hc(another_chart, height = "500px", tabgroup = "My Charts")
} # }