dyLegend align left within a shiny-app

Viewed 600

I want to place the legend of a dygraph within a shiny app on the left hand side of the plot (within the dygraph). My problem is that I cannot set the absolute width of the dygraph since the app runs at different screens with different resolutions.

The code may be like that:

ui.r:

library(dygraphs)
shinyUI(fluidPage(
  titlePanel("Simple example"),
  sidebarLayout(
    sidebarPanel(),
  mainPanel(
    dygraphOutput("dygraph")
  )
 )
))

server.r

library(dygraphs)
shinyServer(function(input, output, session) {
 output$dygraph <- renderDygraph({
  dygraph(discoveries)
 })
})

Is there a way of getting the width of the dygraph? Or maybe a more simple solution of aligning the legend to the left side?

2 Answers
Related