What is highcharter?

Highcharter is a R wrapper for Highcharts javascript library and its modules. Highcharts is very flexible and customizable javascript charting library and it has a great and powerful API.

The main features of highcharter are:

Highcharts

let us start start with a simple example using hchart function.

library(highcharter)
# install.packages("palmerpenguins")
data(penguins, package = "palmerpenguins")

hchart(penguins, "scatter", hcaes(x = flipper_length_mm, y = bill_length_mm, group = species))

Among its features highcharter can chart various objects depending of its class with the generic (magic) hchart function.

x <- c(rnorm(10000), rnorm(1000, 4, 0.5))

hchart(x, name = "data") 

One of the nicest class which hchart can plot is theforecast` class from the {forecast} package.

library(forecast)

airforecast <- forecast(auto.arima(AirPassengers), level = 95)

hchart(airforecast)

Highstock

With highcharter you can use the highstock library which include sophisticated navigation options like_

With highcarter it is easy make candlesticks or ohlc charts using time series data. For example, using data from quantmod package.

library(quantmod)

x <- getSymbols("GOOG", auto.assign = FALSE)
y <- getSymbols("AMZN", auto.assign = FALSE)

highchart(type = "stock") %>% 
   hc_add_series(x) %>% 
   hc_add_series(y, type = "ohlc")

Highmaps

We can chart maps elements and choropleth using the highmaps and build interactive maps to display data linked to geographic objects.

data(GNI2014, package = "treemap")

hcmap(
  "custom/world-robinson-lowres", 
  data = GNI2014,
  name = "Gross national income per capita", 
  value = "GNI",
  borderWidth = 0,
  nullColor = "#d3d3d3",
  joinBy = c("iso-a3", "iso3")
  ) %>%
  hc_colorAxis(
    stops = color_stops(colors = viridisLite::inferno(10, begin = 0.1)),
    type = "logarithmic"
    )