hrbrmstr / taucharts

:bar_chart: An R htmlwidget interface to the TauCharts javascript library
http://rpubs.com/hrbrmstr/taucharts
Other
65 stars 12 forks source link

Smooth transition when subsetting? #15

Open ignacio82 opened 9 years ago

ignacio82 commented 9 years ago

The following shiny app allows me to subset the data and then redraws a bar graph. Is it possible to have an animation where the bars change size instead of the discrete jumps that I have now?

#Fake data
effectiveness <-
  structure(
    list(
      Ranking = structure(
        c(
          5L, 4L, 3L, 2L, 1L, 5L,
          4L, 3L, 2L, 1L, 5L, 4L, 3L, 2L, 1L, 1L, 2L, 3L, 4L, 5L
        ), .Label = c("Bottom",
                      "Bellow Average", "Average", "Above Average", "Top"), class = c("ordered",
                                                                                      "factor")
      ), Probability = c(
        0.4, 0.4, 0.1, 0.08, 0.02, 0.1, 0.2,
        0.5, 0.1, 0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.01, 0.04, 0.15, 0.7,
        0.1
      ), data = c(
        "lots", "lots", "lots", "lots", "lots", "little",
        "little", "little", "little", "little", "none", "none", "none",
        "none", "none", "some", "some", "some", "some", "some"
      )
    ), row.names = c(NA,-20L), .Names = c("Ranking", "Probability", "data"), class = "data.frame"
  )
# Shiny app
server <- function(input, output) {
  output$plot <- renderTaucharts({
    effectiveness %>% filter(data == input$data) %>%
      tauchart(.) %>%
      tau_bar(x = "Ranking", y = "Probability") %>%
      tau_guide_y(tick_format = "%") %>%
      tau_tooltip()
  })

}

ui <- fluidPage(sidebarLayout(
  sidebarPanel(width = 3,
               selectInput(
                 "data", label = h4("Data available:"),
                 choices = c("none", "little", "some", "lots"),
                 selected = 1
               )),
  mainPanel(width = 9, tauchartsOutput("plot"))
))

shinyApp(ui = ui, server = server)

Thanks!

timelyportfolio commented 9 years ago

This is definitely not documented, so I looked in the code and don't see anything there to support transitions. Feel free to post an issue without the R stuff over at tauCharts.

ignacio82 commented 9 years ago

No clue how to generate a little example without R :(

vladminsky commented 9 years ago

Transitions and animation are going to be later. Not now.. sorry

ignacio82 commented 9 years ago

@vladminsky happy to read that they are in the road-map