Skip to content
This repository has been archived by the owner. It is now read-only.

in Shiny: #3

Closed
trebuchet90 opened this issue Feb 25, 2016 · 7 comments
Closed

in Shiny: #3

trebuchet90 opened this issue Feb 25, 2016 · 7 comments

Comments

@trebuchet90
Copy link

@trebuchet90 trebuchet90 commented Feb 25, 2016

I am having no luck with htmlwidgets and radarchart.
I get

ERROR: argument "height" is missing.

#server.R
library(radarchart)


shinyServer(function(input, output) {
  output$radar <- renderChartJSRadar({
    scores <- data.frame("Label"=c("Communicator", "Data Wangler", "Programmer",
                                   "Technologist",  "Modeller", "Visualizer"),
                         "Rich" = c(9, 7, 4, 5, 3, 7),
                         "Andy" = c(7, 6, 6, 2, 6, 9),
                         "Aimee" = c(6, 5, 8, 4, 7, 6))

    chartJSRadar(scores, maxScale = 10, showToolTipLabel=TRUE)
  })
})
#ui.R
shinyUI(fluidPage(

  titlePanel("RADARRRRR "),

  sidebarLayout(
    sidebarPanel(
      numericInput("obs", "Observations:", 10), width = 4
    ),
    mainPanel(
      shinyWidgetOutput("radar", 8, 8), width=8
    )
  )
))
@trebuchet90
Copy link
Author

@trebuchet90 trebuchet90 commented Feb 26, 2016

ok I'm sorry. ui.R is obviously wrong and needs to be:
`

shinyUI(fluidPage(

  titlePanel("RADARRRRR "),

  sidebarLayout(
    sidebarPanel(
      numericInput("obs", "Observations:", 10), width = 4
    ),
    mainPanel(
      chartJSRadarOutput("radar")
    )
  )
))

`
but it is rendering a blank plot with no errors

@trebuchet90
Copy link
Author

@trebuchet90 trebuchet90 commented Feb 26, 2016

ok it is rendering now but its huge and way off page. its ignoring all height and weight parameters in both chartJSRadar() and chartJSRadarOutput

@dougmet
Copy link
Contributor

@dougmet dougmet commented Feb 26, 2016

Agree the canvas element comes out huge. You can control this a little with less flexible containers but I'll investigate and post back a proper solution.

dougmet added a commit that referenced this issue Feb 28, 2016
@dougmet
Copy link
Contributor

@dougmet dougmet commented Feb 28, 2016

Likely will need to mess about with the JS. Added a basic app to inst/shiny-examples/basic to test this out.

dougmet added a commit that referenced this issue Feb 28, 2016
@dougmet
Copy link
Contributor

@dougmet dougmet commented Feb 28, 2016

Looks like the width and height don't work quite how I expected (with % or px). Try the following in your ui.R:

chartJSRadarOutput("radar", width = "450", height = "300")

Does this work for you?

@trebuchet90
Copy link
Author

@trebuchet90 trebuchet90 commented Feb 29, 2016

I don't think that's working either.
I had trouble getting it into sized html elements like tables but the following works great.
so you don't have to worry about me anymore.

.chartJSRadar{
    height: 400px;
    width: 400px;
}
@dougmet
Copy link
Contributor

@dougmet dougmet commented Feb 29, 2016

Thanks for the tip. The way chart.js plots resize is a little mysterious. As we've got most cases working just about OK I'll close for now.

@dougmet dougmet closed this Feb 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.