Backends
chart-backends.Rmddashboardr supports four chart rendering backends. The default is
highcharter. You can switch to plotly,
echarts4r, or ggiraph at the
collection or dashboard level (e.g.Β with
backend = "echarts4r").
Backend overview
Backend (backend=) |
R package (CRAN link) | Licensing considerations | Approx. coverage in dashboardr |
|---|---|---|---|
"highcharter" |
highcharter | Free for academia/non-profit, paid for commercial use. Highcharts JS requires a separate license for commercial or government projects. | Full |
"plotly" |
plotly | Free (MIT). Fully open source for both personal and commercial applications without fees. | Well covered |
"echarts4r" |
echarts4r | Free (Apache 2.0). Open source and safe for commercial products with no licensing costs. | Decent coverage |
"ggiraph" |
ggiraph | Free (GPL-3). Standard open-source license that allows commercial use. | Low |
Licensing & Usage Warnings
Highcharter: While the R wrapper is MIT licensed, the underlying Highcharts JavaScript library is a commercial product. If your dashboard is for a for-profit company or a government entity, you must purchase a license. It is free only for personal, non-commercial, or school-related projects.
Plotly & Echarts4r: These are the preferred enterprise-safe options when there is no budget for per-developer or per-site licenses. Their underlying libraries (Plotly.js and Apache ECharts) are permissive and free for commercial use.
Distribution: If you are distributing your dashboard as a standalone product, check the GPL-3 requirements for
ggiraph. This license requires that any derivative works also be made open source under the same terms.
Data Setup (click to expand)
library(dashboardr)
library(dplyr)
library(gssr)
library(haven)
data(gss_all)
gss <- gss_all %>%
select(year, age, sex, race, degree, happy) %>%
filter(year == max(year, na.rm = TRUE)) %>%
filter(
happy %in% 1:3,
!is.na(age), !is.na(sex), !is.na(race), !is.na(degree)
) %>%
mutate(
happy = droplevels(as_factor(happy)),
degree = droplevels(as_factor(degree)),
sex = droplevels(as_factor(sex)),
race = droplevels(as_factor(race))
)Supported Backends
| Backend | Package | Notes |
|---|---|---|
"highcharter" |
highcharter | Default. Cross-tab filtering support. |
"plotly" |
plotly | Plotly.js with zoom, pan, hover. |
"echarts4r" |
echarts4r | Apache ECharts with animations. |
"ggiraph" |
ggiraph + ggplot2 | Interactive ggplot2 with tooltips. |
Only highcharter is a hard dependency. The others are optional
(Suggests):
install.packages("plotly")
install.packages("echarts4r")
install.packages(c("ggiraph", "ggplot2"))Default: Highcharter
When no backend is specified, highcharter is used:
create_content(data = gss, type = "bar") %>%
add_viz(x_var = "degree", title = "Education (Highcharter)") %>%
preview()Switching Backends
Set backend on individual add_viz()
calls:
Plotly
create_content(data = gss, type = "bar") %>%
add_viz(x_var = "degree", title = "Education (Plotly)", backend = "plotly") %>%
preview()ECharts
create_content(data = gss, type = "bar") %>%
add_viz(x_var = "degree", title = "Education (ECharts)", backend = "echarts4r") %>%
preview()ggiraph
create_content(data = gss, type = "bar") %>%
add_viz(x_var = "degree", title = "Education (ggiraph)", backend = "ggiraph") %>%
preview()Collection-Wide Backend
Set backend in create_content() so all
add_viz() calls inherit it:
create_content(data = gss, type = "bar", backend = "plotly") %>%
add_viz(x_var = "degree", title = "Education") %>%
add_viz(x_var = "race", title = "Race") %>%
preview()Dashboard-Wide Backend
Set backend in create_dashboard() for the
entire project. Individual charts can still override:
proj <- create_dashboard(
title = "Plotly Dashboard",
output_dir = tempdir(),
backend = "plotly"
) %>%
add_dashboard_page(page_title = "Overview", data = gss) %>%
add_viz(type = "bar", x_var = "degree") %>%
add_viz(type = "bar", x_var = "race") %>%
# Override one chart back to highcharter
add_viz(type = "bar", x_var = "sex", backend = "highcharter")Validation with print(check = TRUE)
print(collection, check = TRUE) validates parameters and
column names. This works regardless of which backend is set:
content <- create_content(data = gss, type = "bar") %>%
add_viz(x_var = "degree", title = "Highcharter Bar", backend = "highcharter") %>%
add_viz(x_var = "race", title = "Plotly Bar", backend = "plotly") %>%
add_viz(x_var = "sex", title = "ECharts Bar", backend = "echarts4r")
print(content, check = TRUE)
#> -- Content Collection ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#> 3 items | β data: 3118 rows x 6 cols
#>
#> β’ [Viz] Highcharter Bar (bar) x=degree
#> β’ [Viz] Plotly Bar (bar) x=race
#> β’ [Viz] ECharts Bar (bar) x=sexBackend validity is checked at render time when you call
preview() or generate_dashboard(), not during
validation.
Limitations
Feature parity: All backends support core features (titles, colors, labels, tooltips).
Chart type coverage: Most viz types support all 4 backends. A few exceptions exist (e.g.,
viz_gauge()does not support ggiraph,viz_waffle()does not support echarts4r).