MangoTheCat / radarchart

Implementation of the radar chart from chart.js library
Other
68 stars 25 forks source link

Hover over reveals old charts after update #34

Closed dougmet closed 7 years ago

dougmet commented 8 years ago

Moved from #32 and @tcash21

@alireza202

But for some reason, when some of the skills were checked off, and I hover my mouse over the plot, it started adding them back to the plot, making the plot very jittery. Do you see this too?

@tcash21

I have seen this behavior with the feature-v1api branch.

gist here: https://gist.github.com/tcash21/9b102819c0dec216866fb08d019c5d12

dougmet commented 8 years ago

I've noticed that when the chart updates multiple iframes are stacking up in the DOM. I wonder if the hover over is activating in iframes that are supposed to have been covered over or removed.

frajuegies commented 8 years ago

Hi, I'm observing the same issue when using radarchart in a Shiny environment.... and that makes it difficult to use. Is there a possibility to unable "hovering"? Best regards, Jürgen

dougmet commented 7 years ago

Coming back to this after a longer than expected break. It's only the feature-v1api branch that's causing problems so hopefully easy to debug. Lots of js errors on the front end too:


chartJSRadar.js:22 Uncaught ReferenceError: Chartjs is not defined
    at Object.renderValue (http://127.0.0.1:5795/chartJSRadar-binding-1.0.0.9000/chartJSRadar.js:22:28)
    at Object.renderValue (http://127.0.0.1:5795/htmlwidgets-0.8/htmlwidgets.js:819:25)
    at exports.OutputBinding.shinyBinding.renderValue (http://127.0.0.1:5795/htmlwidgets-0.8/htmlwidgets.js:516:20)
    at exports.OutputBinding.onValueChange (http://127.0.0.1:5795/shared/shiny.min.js:3:24481)
    at exports.OutputBinding.delegator.(anonymous function) [as onValueChange] (http://127.0.0.1:5795/htmlwidgets-0.8/htmlwidgets.js:112:23)
    at OutputBindingAdapter.onValueChange (http://127.0.0.1:5795/shared/shiny.min.js:4:11014)
    at ShinyApp.receiveOutput (http://127.0.0.1:5795/shared/shiny.min.js:3:18086)
    at ShinyApp.<anonymous> (http://127.0.0.1:5795/shared/shiny.min.js:3:19802)
    at ShinyApp._sendMessagesToHandlers (http://127.0.0.1:5795/shared/shiny.min.js:3:19607)
    at ShinyApp.dispatchMessage (http://127.0.0.1:5795/shared/shiny.min.js:3:19397)
renderValue @   chartJSRadar.js:22
renderValue @   htmlwidgets.js:819
shinyBinding.renderValue    @   htmlwidgets.js:516
onValueChange   @   output_binding.js:16
delegator.(anonymous function)  @   htmlwidgets.js:112
onValueChange   @   output_binding_adapter.js:21
receiveOutput   @   shinyapp.js:257
(anonymous) @   shinyapp.js:424
_sendMessagesToHandlers @   shinyapp.js:409
dispatchMessage @   shinyapp.js:393
c.onmessage @   shinyapp.js:91
dougmet commented 7 years ago

OK the js error was easy. Hover over still not good though.

dougmet commented 7 years ago

Interestingly the addition of the iframe has been a bit controversial with chart.js users. https://github.com/chartjs/Chart.js/issues/2210 so now that version 2.4 is available I might check that out and see if we can stop the hidden iframe from being added.

dougmet commented 7 years ago

Maybe a red herring. WIth responsive=FALSE you don't get the iframe and it still has the hover over problem.

dougmet commented 7 years ago

Turns out this was a bit schoolboy. Need to remove the old data from the chart before updating. So a call to Chartjs.destroy() removes it.

frajuegies commented 7 years ago

Dear dougmet,

do you have a small shiny example for me?

Thank you very much Jürgen

dougmet commented 7 years ago

There are some shiny examples in the package. You can run them by typing:

library(radarchart)
runExampleApp("basic")

The code for them is in inst/shiny-examples

frajuegies commented 7 years ago

Sorry for being so late in getting back to you.... I updated the package and now the problem seems to be solved. I will check it in the Shiny app I am realizing and will come back to you....

frajuegies commented 7 years ago

I just checked it... the hovering effect is fine now. Thank you very much Jürgen