Вопрос

updating to the latest Shiny development version 0.8.0.99 seems to had some negative side effects for my charts created via rCharts (version 0.4.2). In particular, I've found the following two issues using Highcharts in my Shiny apps:

  • Tooltip texts do not disappear once activated via hovering
  • Automatic rescaling of the x/y-axis does not work if a series is activated/deactivated

Below you will find a small reproducible example reusing Ramanth's Highchart example from his GitHub page.

This is the standalone Highchart code which works perfectly fine:

library(rCharts)

h1 <- Highcharts$new()
h1$chart(type = "spline")
h1$series(data = c(1, 3, 2, 4, 5, 4, 6, 2, 3, 5, NA), dashStyle = "longdash")
h1$series(data = c(NA, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4), dashStyle = "shortdot")
h1$legend(symbolWidth = 80)
h1

You should encounter the problems described above if you embed the same code in a minimal Shiny app:

library(shiny)
library(rCharts)

runApp(list(
  ui = basicPage(
    h2("Ramnath's GitHub example"),
    showOutput('myChart', 'highcharts')
  ),
  server = function(input, output) {
    output$myChart <- renderChart({
      h1 <- Highcharts$new()
      h1$chart(type = "spline")
      h1$series(data = c(1, 3, 2, 4, 5, 4, 6, 2, 3, 5, NA), dashStyle = "longdash")
      h1$series(data = c(NA, 4, 1, 3, 4, 2, 9, 1, 2, 3, 4), dashStyle = "shortdot")
      h1$legend(symbolWidth = 80)
      # Set dom attribute otherwise chart will not appear on the web page
      h1$set(dom = 'myChart')
      h1
    })
  }
))

I know that I've used the latest development version of Shiny and not the latest stable version. Therefore I have no guarantee that everything works as expected. However, I would be interested if someone has found a solution/workaround for this problem.

Thanks!

Это было полезно?

Решение

It is related to the use of jQuery 1.10.1 in the development version of Shiny. See this SO question to understand details.

I will update highcharts from the master branch on github later this week and that should solve this issue.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top