jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
717 stars 147 forks source link

Option to remove all data tables in the export menu #785

Open tnguyenqh opened 1 year ago

tnguyenqh commented 1 year ago

Highcharter provides users with options to quickly see the underlying data used to plot the chart. I have a shiny app using highcharters, with some simple drop down menus so users can slice and dice the data.

If users select the "View data table" option from the menu, the data table appears. If they change one of the drop down inputs, and then again select "View data table", a second set of data table will appear.

Now if the user select "Hide data table", only one of the tables is removed. I think the option should remove all the tables

library(highcharter)
library(tidyverse)
library(shiny)

ui <- fluidPage(

  selectInput("First", label = "First Variable", width = "100%",
              choices = colnames(iris)), 
  selectInput("Second", label = "Second", width = "100%",
              choices = colnames(iris)),
  highchartOutput("hchartcont")

)

server = function(input, output) {

  output$hchartcont <- renderHighchart({
    df <- iris %>% select(x = input$First, y = input$Second)
    hchart(df, "line", hcaes(x, y)) %>% 
    hc_exporting(enabled = TRUE)
  })

}

shinyApp(ui = ui, server = server)
stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.