Giter Club home page Giter Club logo

d3plus's Introduction

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

Install

devtools::install_github("jpmarindiaz/d3plus")

Examples

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

d3plus's People

Contributors

jpmarindiaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

d3plus's Issues

adding boxplot?

Hi. I tried to add the "box" type using the following code:

if(type == "box"){
    axis = c(2,3)
    id <- names(data)[1]
    xAxis <- names(data)[axis[1]]
    yAxis <- names(data)[axis[2]]

    settings <- list(
      id = id,
      xAxis = xAxis,
      yAxis = yAxis
    )
  }

in settings.R but it's not working. I think the scatter type is practically the same. But for some reason it's not working, any ideas? Thanks!

Tooltip customization

Are there any ways to customize appearance of a tooltip when a user hovers over a square in a tree map? For example I'd like to delete a "Share" item and add few another ones along with apropriate data.
image

Nested Treemap?

Is it possible to make a nested treemap with d3plus like this one?

library(googleVis)
Tree <- gvisTreeMap(Regions,  idvar="Region", parentvar="Parent",
                    sizevar="Val", colorvar="Fac")
plot(Tree)

Thanks!

Personalizing the Output

Hi, @jpmarindiaz ,

I loved your package and I wonder how can I personalize the output showing the share of each class like this:

question

Besides, do you intend to keep adding features to personalize the treemap like adding specific tooltips, nested trees, etc?

Thanks in advance.

Best regards,
Renan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.