Difficulty playing stop histograms in R using digraphs

I used the dygraphs R package to create great stories, but it's hard for me to reproduce the examples given here: http://rstudio.imtqy.com/dygraphs/gallery-custom-plotters.html

I am particularly interested in creating a complex histogram: Desired complex histogram

My data are xts / zoo objects and make good use of the standard dygraph function: sample chart

However, I'm not sure where the dyStackedBarGroup function comes dyStackedBarGroup . It seems that these functions should be created and point to specific plotters in .js files.

In the first example, I see how dyBarChart is created, but in my local dygraph installation there is no stackedbarchar.js / stackedbargroup.js (however I can see the file at https://github.com/rstudio/dygraphs/tree/master/inst/plotters )

Ive tried to transfer all the functions and .js files from the github page, which seem to be unavailable when loading the dygraphs package locally, but I still failed.

Am I doing something completely wrong?

+5
source share
1 answer

set stackedGraph argument in dyOptions to TRUE . dyOptions(stackedGraph = TRUE) .

The javascript file for barchart can be found in the "examples / plotters / barchart.js" package directory dygraphs .

Data:

 lungDeaths <- cbind(mdeaths, ldeaths) 

code:

 # create dygraph plotter library('dygraphs') dyBarChart <- function(dygraph) { dyPlotter(dygraph = dygraph, name = "BarChart", path = system.file("examples/plotters/barchart.js", package = "dygraphs")) } dygraph(lungDeaths) %>% # create dygraph of lungDeaths dyBarChart() %>% # create bar chart with the passed dygraph dyOptions(stackedGraph = TRUE) # make it as stacked bar chart 

enter image description here

+4
source

Source: https://habr.com/ru/post/1276032/


All Articles