Skip to content

rstudio/dygraphs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

added via `usethis::use_github_action("lint")`
70b60ab

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
March 3, 2021 14:21
R
March 3, 2021 14:14
July 12, 2018 00:49
February 28, 2021 21:41
man
February 28, 2021 22:28
March 3, 2021 14:14
February 28, 2021 15:29
October 28, 2014 07:46
February 28, 2021 22:28
February 2, 2016 12:07
February 28, 2021 21:41
February 28, 2021 22:28

dygraphs for R

CRAN status R-CMD-check codecov

The dygraphs package is an R interface to the dygraphs JavaScript charting library. It provides rich facilites for charting time-series data in R, including:

  • Automatically plots xts time series objects (or any object convertible to xts).
  • Highly configurable axis and series display (including optional second Y-axis).
  • Rich interactive features including zoom/pan and series/point highlighting.
  • Display upper/lower bars (e.g. prediction intervals) around series.
  • Various graph overlays including shaded regions, event lines, and point annotations.
  • Use at the R console just like conventional R plots (via RStudio Viewer).
  • Seamless embedding within R Markdown documents and Shiny web applications.

Installation

The dygraphs package depends on the development version of the htmlwidgets package so you need to install both packages. You can do this using the devtools package as follows:

devtools::install_github(c("ramnathv/htmlwidgets", "rstudio/dygraphs"))

Usage

If you have an xts-compatible time-series object creating an interactive plot of it is as simple as this:

dygraph(nhtemp, main = "New Haven Temperatures")

You can also further customize axes and series display as well as add interacitve features like a range selector:

dygraph(nhtemp, main = "New Haven Temperatures") %>%
  dyAxis("y", label = "Temp (F)", valueRange = c(40, 60)) %>%
  dyOptions(fillGraph = TRUE, drawGrid = FALSE) %>%
  dyRangeSelector()

See the online documentation for the dygraphs package for additional details and examples.