Rilcon42
Rilcon42

Reputation: 9763

Add parameter to dygraph

I am trying to change the digits after the decimal in the dygraph being displayed but I get this error:

Error in dygraph(indoConc, { : object 'digitsAfterDecimal' not found

Code

library(dygraphs)
lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths)

indoConc <- Indometh[Indometh$Subject == 1, c("time", "conc")]
dygraph(indoConc,{digitsAfterDecimal:1})

Dygraph link to section: here

Upvotes: 0

Views: 177

Answers (2)

user29609
user29609

Reputation: 2091

Another way is to set the sigFigs option since trailing zeros won't be displayed with digitsAfterDecimal, it depends on your data.

dygraph(indoConc) %>%
dyOptions(sigFigs=1)

Also, it seems like you are confusing Java scripting with the R code used for dygraphs in R. Here is the link to the dygraphs for R package documentation: https://cran.r-project.org/web/packages/dygraphs/dygraphs.pdf

Upvotes: 0

MLavoie
MLavoie

Reputation: 9836

Try this:

dygraph(indoConc) %>% dyOptions(digitsAfterDecimal=1)

for more options, see http://finzi.psych.upenn.edu/library/dygraphs/html/dyOptions.html

Upvotes: 1

Related Questions