Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dyLegend

dygraph legend


Description

Configure options for the dygraph series legend.

Usage

dyLegend(dygraph, show = c("auto", "always", "onmouseover", "follow",
  "never"), width = 250, showZeroValues = TRUE, labelsDiv = NULL,
  labelsSeparateLines = FALSE, hideOnMouseOut = TRUE)

Arguments

dygraph

Dygraph to configure legend options for.

show

When to display the legend. Specify "always" to always show the legend. Specify "onmouseover" to only display it when a user mouses over the chart. Specify "follow" to have the legend show as overlay to the chart which follows the mouse. The default behavior is "auto", which results in "always" when more than one series is plotted and "onmouseover" when only a single series is plotted.

width

Width (in pixels) of the div which shows the legend.

showZeroValues

Show zero value labels in the legend.

labelsDiv

Show data labels in an external div, rather than on the graph. This value should be a div element id.

labelsSeparateLines

Put a <br/> between lines in the label string. Often used in conjunction with labelsDiv.

hideOnMouseOut

Whether to hide the legend when the mouse leaves the chart area. This option applies when show is set to "onmouseover". Note that this also affects the hiding of the dyHighlight on mouse out.

Value

A dygraph with customized legend options

Note

See the online documentation for additional details and examples.

Examples

library(dygraphs)

dygraph(nhtemp, main = "New Haven Temperatures") %>% 
  dySeries("V1", label = "Temperature (F)") %>%
  dyLegend(show = "always", hideOnMouseOut = FALSE)

dygraphs

Interface to 'Dygraphs' Interactive Time Series Charting Library

v1.1.1.6
MIT + file LICENSE
Authors
Dan Vanderkam [aut, cph] (dygraphs library in htmlwidgets/lib, http://dygraphs.com/), Petr Shevtsov [cre, cph], JJ Allaire [aut], RStudio [cph], Jonathan Owen [aut, cph], Daniel Gromer [aut, cph], Benoit Thieurmel [aut, cph], Kent Laukhuf [ctb], jQuery Foundation [cph] (jQuery library), jQuery contributors [ctb, cph] (jQuery library; authors listed in inst/htmlwidgets/lib/jquery/AUTHORS.txt)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.