Skip to contents

Highcharter includes the official Highcharts series and feature modules in its main bundle. They work directly with highchart(); no additional dependency is needed. Stock Tools, its GUI and technical indicators are loaded by highchartstock().

Community plugins are kept separate because they are narrower and can interfere with one another. Add one to an individual widget with hc_add_dependency().

Regression, Grouped Categories and Motion are community plugins. Draggable Points, Pattern Fill and Gantt ship in the Highcharts bundle.

Regression

This plugin was created by Ignacio Vazquez (https://github.com/phpepe) and let you add a regression series to any existing series on your chart. Calculates the r-squared value (coefficient of determination) and optionally prints it on the legend. If Linear or Polynomial regression is selected, you can print the equation on the legend.

library(highcharter)

penguins <- na.omit(palmerpenguins::penguins)

hchart(
  penguins,
  "scatter",
  name = "Penguins",
  hcaes(x = flipper_length_mm, y = bill_length_mm),
  regression = TRUE,
  regressionSettings = list(
    type = "polynomial",
    dashStyle = "ShortDash",
    color = "skyblue",
    order = 3,
    lineWidth = 5,
    name = "%eq | r2: %r",
    hideInLegend = FALSE
  )
) |>
  hc_add_dependency("plugins/highcharts-regression.js")

Even you can get a regression for each series/group.

hchart(
  penguins,
  "scatter",
  hcaes(x = flipper_length_mm, y = bill_length_mm, group = species),
  regression = TRUE
) |>
  hc_colors(c("#d35400", "#2980b9", "#2ecc71")) |>
  hc_add_dependency("plugins/highcharts-regression.js")

A detail of the each parameter can be found in the github page of this plugin: https://github.com/streamlinesocial/highcharts-regression#regression-settings.

Grouped Categories

Home page: http://blacklabel.github.io/grouped_categories/

Let’s try an example:

library(dplyr)

mpgg <- ggplot2::mpg |>
  filter(
    !manufacturer %in% c("volkswagen", "chevrolet"),
    class %in% c("compact", "midsize", "subcompact")
  ) |>
  count(class, manufacturer, name = "count") |>
  arrange(class, manufacturer) |>
  mutate(position = row_number() - 1L)

categories_grouped <- mpgg |>
  select(class, manufacturer) |>
  group_by(name = class) |>
  summarise(categories = list(as.list(manufacturer))) |>
  list_parse()

hchart(
  mpgg,
  "column",
  name = "Cars",
  hcaes(x = position, y = count)
) |>
  hc_xAxis(
    categories = categories_grouped,
    title = list(text = NULL),
    labels = list(distance = 0, style = list(fontSize = "10px"))
  ) |>
  hc_add_dependency("plugins/grouped-categories.js")

Draggable-points

More details in https://api.highcharts.com/highcharts/plotOptions.series.dragDrop.

set.seed(123)

df <- tibble(
  x = runif(10),
  y = runif(10),
  z = runif(10),
  name = paste("cat", 1:10)
)

hchart(
  df,
  "bubble",
  hcaes(x = x, y = y),
  name = "You can move the points",
  cursor = "move",
  dragDrop = list(
    draggableX = TRUE,
    draggableY = TRUE
  )
)
df$x <- NULL

hchart(
  df,
  "column",
  hcaes(x = name, y = y),
  showInLegend = TRUE,
  name = "You can move the points only Yaxis direction",
  cursor = 'ns-resize',
  dragDrop = list(
    draggableY = TRUE
  )
)

Pattern fills

Pattern fill is an official Highcharts module, already included in the shared bundle. It belongs here as a bundled extension: there is no need to add a module dependency. Community plugins such as Motion and Regression remain optional. See https://www.highcharts.com/blog/tutorials/pattern-fills/.

Example taken from https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/series/pattern-fill-area.

# base chart without series
hc_fill <- highchart() |>
  hc_chart(type = 'area') |>
  hc_title(text = 'Pattern fills from the bundled module') |>
  hc_xAxis(
    categories = month.abb
  ) |>
  hc_plotOptions(
    area = list(
      fillColor = list(
        pattern = list(
          path = list(
            d = 'M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11',
            strokeWidth = 3
          ),
          width = 10,
          height = 10,
          opacity = 0.4
        )
      )
    )
  )

# test with 2 series
hc_fill |>
  hc_add_series(
    data = c(29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6),
    color = '#88e',
    fillColor = list(
      pattern = list(
        color = '#11d'
      )
    )
  ) |>
  hc_add_series(
    data = c(NA, NA, NA, NA, NA, 43.1, 95.6, 148.5, 216.4, 194.1, 95.6, 54.4),
    color = '#e88',
    fillColor = list(
      pattern = list(
        color = '#d11'
      )
    )
  )

Gantt schedules

Use hchart(tasks, "gantt") for a schedule with dependencies. See the complete Gantt example for a release plan with progress bars.

Motion

Motion is a community plugin by Lars Cabrera, not an official Highcharts module. Its JavaScript ships separately in the R package; hc_motion() attaches it to this chart. It is not part of the shared Highcharts bundle.

Watch life expectancy change across continents from 1952 to 2007. Each point carries a sequence of population-weighted means from the local Gapminder data. The fixed value scale makes the changes comparable. Press Play or drag the year slider; the chart begins in 1952.

library(highcharter)
library(dplyr)

history <- gapminder::gapminder |>
  group_by(continent, year) |>
  summarise(lifeExp = weighted.mean(lifeExp, pop), .groups = "drop")

years <- sort(unique(history$year))
points <- history |>
  arrange(continent, year) |>
  group_by(name = as.character(continent)) |>
  summarise(y = first(lifeExp), sequence = list(lifeExp), .groups = "drop")

chart <- highchart() |>
  hc_chart(type = "bar", spacingBottom = 88) |>
  hc_title(text = "Longer lives, different trajectories") |>
  hc_subtitle(text = "Population-weighted life expectancy by continent") |>
  hc_xAxis(categories = points$name) |>
  hc_yAxis(
    min = 25,
    max = 85,
    title = list(text = "Life expectancy (years)")
  ) |>
  hc_add_series(
    name = "Life expectancy",
    data = list_parse(points),
    colorByPoint = TRUE
  ) |>
  hc_tooltip(valueDecimals = 1, valueSuffix = " years") |>
  hc_motion(
    labels = as.character(years),
    startIndex = 0,
    magnet = list(step = 1),
    updateInterval = 900
  ) |>
  hc_credits(enabled = TRUE, position = list(y = -65)) |>
  hc_caption(
    text = "Source: Gapminder. The continent means are weighted by population."
  ) |>
  hc_size(height = 460)

if (interactive() && !isTRUE(getOption("knitr.in.progress"))) {
  print(chart)
}
chart

A month-by-month temperature heatmap

Move the slider from January to July to compare summer and winter across the four cities. Each cell follows the same city and day of the month through 2025. Use the first 28 days so every month has the same grid. Each step updates the cell’s value while the color scale stays fixed in degrees Celsius. Playback advances one month every 1.5 seconds.

library(highcharter)
library(dplyr)

cities <- sort(unique(city_weather$city))
cells <- city_weather |>
  arrange(date) |>
  mutate(
    x = as.integer(format(date, "%d")) - 1L,
    y = match(city, cities) - 1L
  ) |>
  filter(x < 28) |>
  group_by(x, y) |>
  summarise(
    value = first(temp_mean),
    sequence = list(lapply(temp_mean, function(t) list(value = t))),
    .groups = "drop"
  )

chart <- highchart() |>
  hc_chart(spacingBottom = 85) |>
  hc_title(text = "Daily mean temperatures, 2025") |>
  hc_xAxis(
    categories = as.character(1:28),
    title = list(text = "Day of month")
  ) |>
  hc_yAxis(categories = cities, title = list(text = NULL)) |>
  hc_colorAxis(
    min = floor(min(city_weather$temp_mean)),
    max = ceiling(max(city_weather$temp_mean)),
    minColor = "#e6f1f5",
    maxColor = "#883429"
  ) |>
  hc_add_series(
    type = "heatmap",
    name = "Daily mean",
    data = list_parse(cells)
  ) |>
  hc_tooltip(
    headerFormat = "",
    pointFormat = "{series.yAxis.categories.(point.y)}, day {series.xAxis.categories.(point.x)}<br>{point.value:.1f} °C"
  ) |>
  hc_motion(
    labels = month.name,
    startIndex = 0,
    magnet = list(step = 1),
    updateInterval = 1500
  )

if (interactive() && !isTRUE(getOption("knitr.in.progress"))) {
  print(chart)
}
chart

Chart language

Hover over a month to compare its date in Spanish, French, Portuguese, Norwegian Bokmål, Simplified Chinese and Japanese across six connected Stock charts. The first 36 months of AirPassengers keep individual months easy to inspect. Use the translated range buttons to change the period in all six panels, and open each export menu to compare its controls. Each widget captures its own language when created; options(old) restores the previous session setting after building the grid.

library(highcharter)
hc_set_theme("hcrt")

locales <- c(
  "Spanish (Chile)" = "es-CL",
  "French" = "fr-FR",
  "Portuguese (Brazil)" = "pt-BR",
  "Norwegian (Bokmal)" = "nb-NO",
  "Simplified Chinese" = "zh-CN",
  "Japanese" = "ja-JP"
)
old <- options("highcharter.lang")
charts <- lapply(names(locales), function(language) {
  hc_set_language(locales[[language]])
  highchart(type = "stock") |>
    hc_add_series(head(AirPassengers, 36), name = "Passengers") |>
    # Raise the chart's stacking context while its export menu is open.
    hc_chart(
      events = list(
        exportMenuShown = JS(
          "function () { this.container.style.zIndex = '1'; }"
        ),
        exportMenuHidden = JS(
          "function () { this.container.style.zIndex = '0'; }"
        )
      )
    ) |>
    hc_title(text = language) |>
    # Permit one-month ranges with monthly observations.
    hc_xAxis(crosshair = TRUE, minRange = 28 * 86400000) |>
    hc_yAxis(title = list(text = NULL)) |>
    hc_legend(enabled = FALSE) |>
    hc_navigator(enabled = FALSE) |>
    hc_scrollbar(enabled = FALSE) |>
    hc_rangeSelector(enabled = TRUE, selected = 5) |>
    hc_tooltip(
      xDateFormat = "%[B] %Y",
      valueDecimals = 0,
      outside = TRUE,
      split = FALSE
    ) |>
    hc_exporting(enabled = TRUE) |>
    hc_connect("chart-language", sync = c("hover", "zoom")) |>
    hc_size(height = 380)
})
options(old)

language_grid <- htmltools::browsable(htmltools::tagList(
  htmltools::tags$meta(
    name = "viewport",
    content = "width=device-width, initial-scale=1"
  ),
  htmltools::tags$style(
    ".chart-language-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
     .chart-language-grid > div { min-width: 0; }
     @media (max-width: 575px) { .chart-language-grid { grid-template-columns: 1fr; } }"
  ),
  htmltools::div(class = "chart-language-grid", charts),
  htmltools::tags$p(
    "Japanese interface labels are AI-generated translations, not human-reviewed. Localized dates use the browser's Intl formatting."
  )
))

if (interactive() && !isTRUE(getOption("knitr.in.progress"))) {
  print(language_grid)
}
language_grid

Japanese interface labels are AI-generated translations, not human-reviewed. Localized dates use the browser's Intl formatting.

hc_set_language() selects the text shown in chart controls. To choose the typeface for those labels, see Use system fonts with a preset.

Draggable Legend

The Draggable Legend plugin lets readers reposition a legend. Load it for one widget with hc_add_dependency("plugins/draggable-legend.js").

For click-to-detail navigation, see Drilldown.