I am trying to adjust plots in flexdashboard by taking the pixelratio provided by the user session, this works fine when I am rendering plot with renderPlot but I am struggling to assign dynamic heights / widths to plots that are rendered with renderPlotly
I extract the user pixel ratio as followed
pixelratio <- reactive({
session$clientData$pixelratio
})
attempt 1
output$myplot <- renderPlotly(myplot())
plotlyOutput("myplot", height = function() {900 / pixelratio()}, width = 825)
the first attempt is giving the following error msg :
Error : CSS units must be single element numeric or character vector
attempt 2
output$myplot <- renderPlotly(myplot())
plotlyOutput("myplot", height = 900 / pixelratio(), width = 825)
the second attempt is submitting the following error msg:
Error : Operation not allowed without an active reactive context.
* You tried to do something that can only be done from inside a reactive consumer
Is there a way to get pixelratio in order to autoscale plotlyOutput?