html_dependencies_d3: D3 HTML dependencies

View source: R/dependencies.R

html_dependencies_d3R Documentation

D3 HTML dependencies

Description

Create HTML dependencies for D3 and optional extensions

Usage

html_dependencies_d3(version = c("6", "5", "4", "3"), extensions = NULL)

Arguments

version

Major version of D3

extensions

D3 extensions to include. Currently the only supported extension is "jetpack" (https://github.com/gka/d3-jetpack).

Details

Create list of HTML dependencies for D3. Each version has a distinct root D3 object so it's possible to combine multiple versions of D3 on a single page. For example, D3 v5 is accessed via d3v5 and D3 v4 is accessed via d3v4. Note however that D3 v3 is accessed via simply d3 (for compabibilty with existing htmlwidgets that use this form).

Note

This function is exported for use by htmlwidgets. If you are using the r2d3() function to include D3 code within a document or application this dependency is included automatically so calling this function is unnecessary.

Examples


library(r2d3)
r2d3(
  data = c (0.3, 0.6, 0.8, 0.95, 0.40, 0.20),
  script = system.file("examples/barchart.js", package = "r2d3"),
  dependencies = "d3-jetpack"
)


r2d3 documentation built on March 18, 2022, 7:17 p.m.