hrbrmstr / streamgraph

:wavy_dash: htmlwidget for creating streamgraph visualizations in R
http://hrbrmstr.github.io/streamgraph/
Other
148 stars 49 forks source link

streamgraphs and rCharts #14

Open daniel319 opened 8 years ago

daniel319 commented 8 years ago

First I want to congratulate you on the excellent package. Second I have a problem of an apparently interaction with rCharts package. In a shiny streamgraphs does not show the x axis values. I hope it is clear by the following example.

library(shiny)
library(dplyr)
library(rCharts)
library(babynames)
library(streamgraph)

server <- function(input, output) {
  output$chartDepo <- renderChart2({
    hair_eye = as.data.frame(HairEyeColor)
  p2 <- nPlot(Freq ~ Hair, group = 'Eye',
              data = subset(hair_eye, Sex == "Female"),
              type = 'multiBarChart'
  )
  p2$chart(color = c('brown', 'blue', '#594c26', 'green'))
  return(p2)
})

  stgr1 <- babynames %>%
    filter(grepl("^Kr", name)) %>%
    group_by(year, name) %>%
    tally(wt=n) %>%
    streamgraph("name", "n", "year")
  output$stgr1 <- renderStreamgraph(stgr1)
}

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      ),
    mainPanel(              showOutput("chartDepo", "nvd3"),
      streamgraphOutput('stgr1')

              )
  )
)

shinyApp(ui = ui, server = server)

Regards,

Daniel Merino

hrbrmstr commented 8 years ago

thx Daniel, I'll take a look.