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

Description Usage Arguments Value See Also Examples

View source: R/dependencies.R

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

1
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()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## 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 Jan. 13, 2021, 6:13 p.m.