Dygraphs

The dygraphs library in JavaScript (http://dygraphs.com/) is designed to show time series and trend data. It supports zoom, pan, and mouseover, and even supports mobile devices by offering pinch to zoom. The dygraphs R package provides a handy interface to many of the functions of the dygraphs library. It can be installed using install.packages("dygraphs").

For more information about the dygraphs package, see the following link, http://rstudio.github.io/dygraphs/.

Let's take a look at an example graph:

Google Analytics

There are a couple of things you need to make a note of on this graph. First, you can see the mouseover effect at the top-right of the graph, where the date and values of NHS users and Other are listed. Second, this graph has been smoothed using a rolling average. The number of points to be averaged is specified in the widget on the left-hand side of the page (Select roll period) and is given by default in the small square box at the bottom-left of the graph. Third, the gray box at the bottom with the selector on either side can be used to select date ranges on the graph. This can be useful in a Shiny application as a way of keeping the date range of all the data constants but allowing the user to zoom in on the graph as they choose. As you can see, the text underneath the graph makes this distinction clear, reporting the number of days in the whole dataset (933) as well as the number selected on the graph itself (578). Making a graph user-friendly and interactive is extremely easy using the dygraphs package.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset