dygraphs icon indicating copy to clipboard operation
dygraphs copied to clipboard

Synchronize multiple dygraphs on selection/highlight in Shiny?

Open ghost opened this issue 8 years ago • 11 comments

Hi there,

In a shiny application using dygraphs is there any way to synchronize grouped dygraphOutputs on selection/highlight as well as zoom i.e http://dygraphs.com/gallery/#g/synchronize or http://www.highcharts.com/demo/synchronized-charts? Would this require including some custom javascript?

Thanks for the awesome package! Hope this query hasn't been raised before - couldn't find anything on the web. Hayden

ghost avatar May 24 '16 16:05 ghost

Hello, I have exactly the same issue, did you eventually find out how to proceed? Thanks

Lizette84 avatar Jun 05 '16 16:06 Lizette84

No I haven't yet sorry, I was considering trying to use an observer function to look for the events ('drawCallback', 'highlightCallback', 'unhighlightCallback') then update the other dygraphs using dyCallbacks(). Or trying to figure out how to make an html widget for this synchronize function; synchronizer.js. I'll let you know if I get something working

ghost avatar Jun 11 '16 04:06 ghost

You can make a call to the dygraph function in the renderDygraphcall in order to set the group parameter like this :

library(shiny)
library(dygraphs)


ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(),
    mainPanel(dygraphOutput("dyPlot1"),
              dygraphOutput("dyPlot2"))
  )
)

server <- function(input, output) {
  output$dyPlot1 <- renderDygraph({
    dygraph(ldeaths, main = "All", group = "lung-deaths")
  })

  output$dyPlot2 <- renderDygraph({
    dygraph(mdeaths, main = "All", group = "lung-deaths")
  })
}


shiny::runApp(list(ui = ui, server = server))

Tutuchan avatar Jun 16 '16 15:06 Tutuchan

Thanks for your feedback, I have been using this functionality as described in the dygraphs documentation.

The question was whether we can build on this group zooming synchronisation to also synchronise the selection highlighting.

Compare the output from your code example to my original example links to see the selection synchronisation.

ghost avatar Jun 17 '16 14:06 ghost

My bad I didn't realize your point was mainly about the highlighting. I'll have a look at this when I have some time.

Tutuchan avatar Jun 21 '16 08:06 Tutuchan

Hello,

has anybody resolved this issue yet? I'm as well looking for this feature not only to synchronize the plots zoom wise but also on selection.

panoptikum avatar Jun 09 '17 10:06 panoptikum

Hi,

I'm having the same issue, has someone been able to solve it?

irecasens avatar Nov 19 '17 00:11 irecasens

Me too, I'm having the same issue.

aropele avatar Dec 14 '17 11:12 aropele

any solution so far?

elikesprogramming avatar Apr 28 '18 01:04 elikesprogramming

any solution?

AZAZELPE avatar May 21 '19 23:05 AZAZELPE

Unfortunately it is been a long time since R dygraphs has any update. I hope this project doesn't die because it is an important package with great potential additions.

GitHunter0 avatar Jul 31 '20 01:07 GitHunter0