Skip to content
This repository was archived by the owner on Apr 10, 2019. It is now read-only.

Update chart rather than redrawing it in Shiny#42

Merged
dougmet merged 2 commits into
MangoTheCat:masterfrom
AdeelK93:master
Mar 27, 2017
Merged

Update chart rather than redrawing it in Shiny#42
dougmet merged 2 commits into
MangoTheCat:masterfrom
AdeelK93:master

Conversation

@AdeelK93

Copy link
Copy Markdown
Contributor

Check out your shiny-examples/options demo to see what I mean

@dougmet

dougmet commented Mar 27, 2017

Copy link
Copy Markdown
Contributor

This is great!

Do you want to add yourself as a contributor? If so just update the DESCRIPTION file with role="ctb" and I'll merge straight in.

@AdeelK93

Copy link
Copy Markdown
Contributor Author

Sure thing, thank you!

@dougmet
dougmet merged commit 1016356 into MangoTheCat:master Mar 27, 2017
@dougmet

dougmet commented Mar 27, 2017

Copy link
Copy Markdown
Contributor

Thanks again, really like this feature.

@Chrisss93

Copy link
Copy Markdown

Unfortunately, this appears to prevent the radarchart labels from being dynamically redrawn.

Contrast the behaviour of the following example between v0.3.1 and v0.3.1.9

shinyApp(
    pageWithSidebar(
        headerPanel('Radarchart with reactive data'),
        sidebarPanel(
            checkboxGroupInput('eye', 'Eye-color?', attr(HairEyeColor, "dimnames")$Eye, 
                               selected = "Black"),
            checkboxGroupInput("hair", "Hair colors", attr(HairEyeColor, "dimnames")$Hair, 
                               selected = "Black"),
            actionButton("go", "GO!")
        ),
        mainPanel(
            chartJSRadarOutput("radar", width = "450", height = "300"), width = 7
        )
    ),
    function(input, output) {
        obs <- eventReactive(input$go, {
            df <- as.data.frame(HairEyeColor) 
            df <- df[df$Eye %in% input$eye & df$Sex %in% "Male",]
        })
        output$radar <- renderChartJSRadar({
            dta <- tidyr::spread(obs(), Hair, Freq)
            chartJSRadar( dta[, c("Eye", input$hair)] )
        })
    }
)

@AdeelK93

Copy link
Copy Markdown
Contributor Author

Hi @Chrisss93, I've fixed this in #45! Good catch, dynamically updating labels was not something I had tried or considered

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants