Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rHighcharts issue : bar chart #5

Open
ochees opened this issue Apr 15, 2015 · 0 comments
Open

rHighcharts issue : bar chart #5

ochees opened this issue Apr 15, 2015 · 0 comments

Comments

@ochees
Copy link

ochees commented Apr 15, 2015

Hello,

I post an issue concerning rcharts (highchart) library and shinydashboard in rCharts repository. I need this kind of visualisation and I didn't find a solution. Here, the problem :

This is an example of application mixing shinydashboard and Highchart. There are two problems :
-first, with an initial input of 50, the app doesn't display the plot. The user must click on the label "Series 1" to load the plot. Not intuitive.
-with a variable numeric input, the plot is totally blank and doesn't response anymore to the input user.
The problem is the same when using an action button and isolate function or not.

library(shiny)
library(shinydashboard)
library(rCharts)

ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard"),
  dashboardSidebar(),
  dashboardBody(
    # Boxes need to be put in a row (or column)
    fluidRow(
      box(title = "Slider", status = "primary",sliderInput("slider", "Slider input:", 1, 100, 50)),
      box(title = "Load", status = "primary",actionButton("actionButton","Load",icon=icon("refresh"))),
      box(title = "Plot", status = "primary",showOutput("chart", "highcharts"))
      )
    )
  )
)

server <- function(input, output) {
output$chart <- renderChart2({
input$actionButton
a <- Highcharts$new()
a$chart(width=500,height=500)
a$series(data = list(
list(x = 0, y = isolate(input$slider), capital = "Stockholm", country = "Sweden"),
list(x = 1, y = isolate(input$slider)+10, capital = "Copenhagen", country = "Denmark"),
list(x = 2, y = isolate(input$slider)+20, capital = "Oslo", country = "Norway")
), type = "bar"
)
a$xAxis(categories = c("Sweden", "Denmark", "Norway"))
a$addParams(dom = "chart")
return(a)
})
}
shinyApp(ui, server)

Maybe it's a bad interaction between shinydashboard and rCharts ? this app works well using a classic shiny structure or a type of graph "column".

Besides, i would know if it's possible to draw in this kind of graph a vertical (for a bar chart) or horizontal (column chart), parallel to x axis, as a limit ? I saw something with the plotLines command in highcharts js. In the same way, is it possible to add text on chart with R ?

Thanks a lot,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant