d3_dep_jetpack: 'd3.js' Dependency for Version 4 Jetpack

View source: R/dependencies.R

d3_dep_jetpackR Documentation

'd3.js' Dependency for Version 4 Jetpack

Description

d3-jetpack is a set of nifty convenience wrappers that speed up your daily work with d3.js. Must be included after d3_dep_v4(). Learn more by reading d3-jetpack or by watching this YouTube.

Usage

d3_dep_jetpack(offline = TRUE)

Arguments

offline

logical to specify whether to use a local copy of d3.js (TRUE) or use cdn (FALSE)

Value

htmltools::htmlDependency

See Also

Other 'd3' dependency functions: d3_dep_v3(), d3_dep_v4(), d3_dep_v5(), d3_dep_v6(), d3_dep_v7()

Examples

## Not run: 

library(d3r)
library(htmltools)

tl <- tagList(tags$script(HTML(sprintf(
"
var x = 5;

var svg = d3.select('body')
    .append('svg');

svg.append('rect')
    .at({
        x: 100,
        y: 100,
        width: 100,
        height: 100
    })
    .st({
        fill: 'blue',
        stroke: 'purple'
    });
"
))), d3_dep_v4(), d3_dep_jetpack())
browsable(tl)



tl <- tagList(tags$script(HTML(sprintf(
 "
 var svg = d3.select('body')
     .append('svg');

 test_data = [{x: 250, y: 250}, {x: 300, y: 300}, {x: 300, y: 100}];

 svg.appendMany(test_data, 'circle')
     .at({
         cx: function(d){return d.x},
         cy: function(d){return d.y},
         r: 50
     })
     .st({
         fill: 'purple',
         stroke: 'blue'
     });
 "
))), d3_dep_v4(), d3_dep_jetpack())

browsable(tl)


## End(Not run)

d3r documentation built on Oct. 2, 2023, 5:08 p.m.