Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
Created December 21, 2014 21:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timelyportfolio/cf7b94048ffe7b6a0112 to your computer and use it in GitHub Desktop.
Save timelyportfolio/cf7b94048ffe7b6a0112 to your computer and use it in GitHub Desktop.
htmlwidgets dygraphs only show highlighted legend
library(dygraphs)
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) -> d1
#this is a hack to set css directly
# dyCSS designed to read a text css file
d1$x$css = "
.dygraph-legend > span {display:none;}
.dygraph-legend > span.highlight { display: inline; }
"
d1
@APophale
Copy link

This is so awesome. Thanks so much. This is exactly what I was looking for.

@phileas-condemine
Copy link

Neat !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment