1

I would like to be able to create a plot with only one time serie but I want the interactive values to be displayed to come from two time series. Ideally, I would like to have something like this :

enter image description here

I know how to plot two time series

library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
# This one creates a plot with the two time series
dygraph(lungDeaths)

I know how to plot only one time serie

# This one creates a plot with the mdeaths time serie
dygraph(lungDeaths[,1])

But How to plot one time serie, but display the values of two time series?

hans glick
  • 2,431
  • 4
  • 25
  • 40
  • This is not probably pretty. But you can try this: `dygraph(lungDeaths) %>% dyOptions(colors = c("#FFFFFF", "yellow"))` – jazzurro Jul 31 '19 at 13:54
  • Yeah I tried it but the problem is that as the color of the second time series is white, I cannot see its interactive values (at the top right) which I want – hans glick Jul 31 '19 at 13:57
  • What about changing the background color to another color and draw the 2nd line with the same color? Then, you will see the information at the top right, I guess. – jazzurro Jul 31 '19 at 14:01
  • What about this? `dygraph(lungDeaths) %>% dyAxis("x", drawGrid = FALSE) %>% dyShading(from = "1974-01-01", to = "1980-12-31", color = "black") %>% dyOptions(colors = c("black", "yellow")) `? – jazzurro Jul 31 '19 at 14:07
  • Yep, it works but the y axis is not relevant anymore. I want to add a dozen of series with different value ranges so, I will have a problem – hans glick Jul 31 '19 at 14:27
  • I see. I am off to bed. Hope somebody else can assist you more. – jazzurro Jul 31 '19 at 14:36

0 Answers0