hrbrmstr / metricsgraphics

:chart_with_upwards_trend: htmlwidget interface to the MetricsGraphics.js D3 chart library
http://hrbrmstr.github.io/metricsgraphics/
Other
132 stars 35 forks source link

Dealing with explicitly provided widget id warning when using shiny #49

Closed mihirasaraswati closed 7 years ago

mihirasaraswati commented 8 years ago

I've built a shiny application that uses metricsgraphics to create histogram. When running the application I get the following error message:

Warning in output$histPlot(...) : Ignoring explicitly provided widget ID "mjs-acd1c2bc860bf1a81780a7603d6f7b"; Shiny doesn't use them

My app can be run with the following command:

shiny::runGitHub(repo = 'mihiriyer/mental')

My code is located here: https://github.com/mihiriyer/mental/blob/master/app.R

The app seems to work fine and so should I even be worried since it is just a warning? Should I just suppress the message and move on?

hrbrmstr commented 8 years ago

aye. Shiny does it's own "thing" with widget id's which is somewhat frustrating given how multiple metricsgraphics widgets can be linked together automagically but also understandable since Shiny does much more automagically for developers. i haven't heard of it causing issues with Shiny apps, but you may not be able to easily link metricsgraphics charts together in a Shiny context.

timelyportfolio commented 8 years ago

This is still ugly, but if you provide an elementId argument to the mjs_plot in lines, and then accept that if provided in lines, you would still get the warning, but linking could still occur for advanced users. In a Shiny context, a user will be required to assign an id, so we know each metricsgraphicsOutput will have a hopefully unique id.

mihirasaraswati commented 8 years ago

Well I only have one graph so no linking is required... I've added options(warn =-1) to my server function and that has done the "trick". Thanks for the assist.

ricardordb commented 6 years ago

Workaround: https://github.com/ropensci/plotly/issues/985