Plotly: Ignoring explicitly provided widget ID; Shiny doesn't use them

Created on 28 Apr 2017  路  8Comments  路  Source: ropensci/plotly

I am using the current version of plotly and shiny. Whenever I am trying to create a plot, I am getting a warning:

Ignoring explicitly provided widget ID "fcfd29930da9"; Shiny doesn't use them

I have tested it with and without using plotly, and the warning seems to be associated with plotly.

Shiny and plotly versions:

plotly_4.6.0.9000
shiny_1.0.3

Most helpful comment

This hack does the trick for now, but they should really merge this PR https://github.com/ramnathv/htmlwidgets/pull/265

library(shiny)
library(plotly)

ui <- fluidPage(
  plotlyOutput("p")
)

server <- function(input, output, ...) {

  output$p <- renderPlotly({
    p <- plotly_build(qplot(1:10))
    p$elementId <- NULL
    p
  })

}

shinyApp(ui, server)

All 8 comments

It should be safe to ignore this warning. I decided to add an id to avoid this warning in rmarkdown documents, which in my mind, is more annoying

@cpsievert is there any way to suppress this warning (without a global side effect like suppressing all warnings)?

This hack does the trick for now, but they should really merge this PR https://github.com/ramnathv/htmlwidgets/pull/265

library(shiny)
library(plotly)

ui <- fluidPage(
  plotlyOutput("p")
)

server <- function(input, output, ...) {

  output$p <- renderPlotly({
    p <- plotly_build(qplot(1:10))
    p$elementId <- NULL
    p
  })

}

shinyApp(ui, server)

Awesome, as long as you don't think p$elementId <- NULL might breaks in a future date, I'm happy to use that :)

While the warning has vanished with setting elementId <- NULL, it produces probably another warning when stopping the app:

Warning message: In rm(list = as.character(handle), pos = .wsconns) : object '4516200352' not found

hi,
using the above fix, I am still unable to generate a plot, a plot background just pops up without any kind of plot on it. please Advise.

@vamsitroy this workaround is no longer required with the dev version:

devtools::install_github('ropensci/plotly')

@cpsievert I downloaded the lastest dev version of plotly. I'm trying to test my shiny-app using shinytest.
It finds a difference between expected and current, since the elementId is everytime newly generated. Is there a workaround?
Thank in advance!

Here the screenshot:
grafik

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GegznaV picture GegznaV  路  3Comments

msummersgill picture msummersgill  路  3Comments

robertleitner picture robertleitner  路  5Comments

crarlus picture crarlus  路  3Comments

ratnanil picture ratnanil  路  3Comments