library(r2d3)
## Warning: package 'r2d3' was built under R version 4.0.5
# https://rstudio.github.io/r2d3/
# https://observablehq.com/@eightants/moving-bubble-chart-using-d3-js-internship-search-data-w-per
# https://flowingdata.com/2017/05/17/american-workday/
# https://bookdown.org/content/b298e479-b1ab-49fa-b83d-a57c2b034d49/general.html#interactive-charts
# https://flowingdata.com/2019/04/22/moving-bubbles-tutorial-v2/
# https://www.youtube.com/watch?v=fmu1wVS6gLo
path="D:\\Users\\EChen13\\OneDrive - JNJ\\Documents\\R examples\\D3\\"
r2d3(data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20), script = paste0(path, "barchart.js"))
bars <- c(10, 20, 30)
svg.selectAll('rect')
.data(data)
.enter()
.append('rect')
.attr('width', function(d) { return d * 10; })
.attr('height', '20px')
.attr('y', function(d, i) { return i * 22; })
.attr('fill', options.color);