Description Usage Arguments Value Available plotters Examples
Plotters provide variuos ways to customize how your data appears
on the dygraph. Series-based plotters allow users to mix-and-match different plotters on a
per-series or (with dyGroup) a per-group basis. See dyPlotter
for additional detail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | dyCandlestick(dygraph, compress = FALSE)
dyBarChart(dygraph)
dyStackedBarChart(dygraph)
dyMultiColumn(dygraph)
dyBarSeries(dygraph, name, ...)
dyStemSeries(dygraph, name, ...)
dyShadow(dygraph, name, ...)
dyFilledLine(dygraph, name, ...)
dyErrorFill(dygraph, name, ...)
dyMultiColumnGroup(dygraph, name, ...)
dyCandlestickGroup(dygraph, name, ...)
dyStackedBarGroup(dygraph, name, ...)
dyStackedLineGroup(dygraph, name, ...)
dyStackedRibbonGroup(dygraph, name, ...)
|
dygraph |
Dygraph to add plotter to |
compress |
(For dyCandlestick) If true, compress data yearly, quarterly, monthly, weekly or daily according to overall amount of bars and/or current zoom level. |
name |
name - or chrarcter vector of names - of (the) series within the data set |
... |
additional options to pass to dySeries |
A dygraph with the specified plotter(s) employed.
Currently the dygraphs package provides the following plotters:
Draws a bar plot rather than a line plot. If the provided dygraph features more than one series, dyBarChart will call dyMultiColumn instead.
Draws a bar chart stacking all the underlying series.
Draws multiple column bar chart.
Draws a single set of bars for just the provided series.
Draws a single set of stems for just the provided series.
An extraction of the _fillplotter from dygraph-combined-dev.js, drawing the filled area without the line.
An extraction of the _fillplotter and _lineplotter combo from dygraph-combined-dev.js. dyFilledLine allows users to fill only a single series.
The multicolumn plotter, but on a subset of the series, leaving the others for other plotters.
Draw a candlestick chart.
Employed on the provided series, but still plotting the others.
Return the data group as stacked bars
Return the data group as stacked ribbons
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | ## The following two examples will results in the same dygraph:
dygraph(mdeaths) %>%
dyBarChart()
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths) %>%
dyMultiColumn()
## Per-series plotters:
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths) %>%
dyBarSeries('fdeaths')
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths) %>%
dyStemSeries('fdeaths')
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths) %>%
dyShadow('fdeaths')
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths) %>%
dyFilledLine('fdeaths')
## A bunch of different plotters together:
lungDeaths <- cbind(fdeaths, mdeaths, ldeaths, foo = fdeaths/2, bar = fdeaths/3)
dygraph(lungDeaths) %>%
dyRangeSelector() %>%
dyBarSeries('bar') %>%
dyStemSeries('mdeaths') %>%
dyShadow('foo') %>%
dyFilledLine('fdeaths')
## Group-based plotters:
## Candlestick plotters:
library(xts)
data(sample_matrix)
library(dygraphs)
dygraph(sample_matrix) %>%
dyCandlestick()
sample<-data.frame(sample_matrix)
sample_2<-sample*2
names(sample_2)<-c('O', 'H', 'L', 'C')
sample<-cbind(sample, sample_2)
dygraph(sample) %>%
dyOptions(stackedGraph = TRUE) %>%
dyCandlestickGroup(c('Open', 'High', 'Low', 'Close')) %>%
dyCandlestickGroup(c('O', 'H', 'L', 'C'))
## Stacked Bar and Ribbon Graphs:
dygraph(lungDeaths) %>%
dySeries('mdeaths', axis = 'y2') %>%
dyAxis('y', valueRange = c(-100, 1000)) %>%
dyStackedBarGroup(c('ldeaths', 'fdeaths'))
lungDeaths <- cbind(ldeaths, fdeaths, mdeaths,
additive = rep.int(200, length(ldeaths)),
line = rep.int(3000, length(ldeaths)))
dygraph(lungDeaths) %>%
dySeries('line', strokePattern = 'dashed') %>%
dySeries('ldeaths', stepPlot = TRUE) %>%
dyStackedBarGroup(c('additive', 'mdeaths')) %>%
dyStackedRibbonGroup(c('fdeaths', 'ldeaths'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.