An open API service indexing awesome lists of open source software.

https://github.com/jpmarindiaz/d3plus

R Htmlwidget for d3plus (http://d3plus.org)
https://github.com/jpmarindiaz/d3plus

Last synced: 5 months ago
JSON representation

R Htmlwidget for d3plus (http://d3plus.org)

Awesome Lists containing this project

README

        

> Warning: Alpha release. This is work in progress. Use at own risk.

# Install

`devtools::install_github("jpmarindiaz/d3plus")`

# Examples

```r
library(d3plus)

# Some networks
edges <- read.csv(system.file("data/edges.csv", package = "d3plus"))
nodes <- read.csv(system.file("data/nodes.csv", package = "d3plus"))
d3plus("rings",edges)
d3plus("rings", edges, focusDropdown = TRUE)
d3plus("rings", edges, nodes = nodes,focusDropdown = TRUE)
d3plus("network", edges)
d3plus("network",edges,nodes = nodes)

# A scatter plot
countries <- read.csv(system.file("data/countries.csv", package = "d3plus"))
d3plus("scatter", countries)

# Grouping bubbles
bubbles <- read.csv(system.file("data/bubbles.csv", package = "d3plus"))
d3plus("bubbles", bubbles)

# Some treemaps
d3plus("tree", countries)
d3plus("tree", bubbles[c("name","value")])

# Some lines
## Not working
#data <- read.csv(system.file("data/expenses", package = "d3plus"))
#d3plus("lines", data)

# Saving widgets
s <- d3plus("tree", countries)
htmlwidgets::saveWidget(s,"index.html", selfcontained = FALSE)
## Selfcontained= TRUE not working
# htmlwidgets::saveWidget(s,"index.html")

# A nice shiny app
library(shiny)
app <- shinyApp(
ui = bootstrapPage(
checkboxInput("swapNCols","Swap columns",value=FALSE),
d3plusOutput("viz")
),
server = function(input, output) {
countries <- read.csv(system.file("data/countries.csv", package = "d3plus"))
output$viz <- renderD3plus({
d <- countries
if(input$swapNCols){
d <- d[c(1,3,2)]
}
d3plus("tree",d)
})
}
)
runApp(app)

```

# Todo

- make sure column names are source and target for networks
- validate cols
- Lines only working when date is Year... for now