dygraphs

How to use UTF-8 characters in dygraph title in R

故事扮演 提交于 2019-12-04 07:25:22
Using Rstudio [Windows8], when I use the dygraph function to plot a time series, I have a problem when trying to use UTF-8 characters in the main title. library(dygraphs) dygraph(AirPassengers, main = "Título") This results in a title: "T?tulo" I have tried to convert "Título" to the utf-8 enconding, but it doesn't work. You need to make sure your locale settings support the character that you want to use, and that the file is saved with the right encoding. Saving as UTF-8 worked for me. I was able to replicate your situation in Windows 7 and tried a bunch of things. Embedded in Rmarkdown,

R How to shade week-end period with dygraphs?

倖福魔咒の 提交于 2019-12-04 07:17:00
How can I shade week-end period with dyShading, in r dygraphs? I use the code below, but is there a simple way? library(lubridate) library(xts) library(dygraphs) dateP<-seq(as.POSIXct("2015-01-01 "), as.POSIXct("2015-02-01 "), by="days") toto<-rep(6,length(dateP)) tutu<-xts(toto, order.by=dateP) dateWD<-dateP[isWeekend(dateP, wday = 0:4)] ok_periods<-0 i=1 j=1 while (i<(length(dateWD)-1)){ ok_periods[j] <- list(list(from = dateWD[i], to = dateWD[i+1])) i=i+2 j=j+1 } add_shades<-function(x,periods){ for(period in periods){ x<-dyShading(x, from=period$from,to=period$to) } x } dygraph(tutu) %>%

How to set x-axis in dygraphs for R to show just month

有些话、适合烂在心里 提交于 2019-12-03 08:47:05
I have the following time series ( data.in . that starts on 2012-01-01 and ends 2012-12-31): ts.rmean ts.rmax 2012-01-01 3.163478 5.86 2012-01-02 3.095909 4.67 2012-01-03 3.112000 6.01 2012-01-04 2.922800 5.44 2012-01-05 2.981154 5.21 2012-01-06 3.089167 5.26 and I am using dygraph for R for plotting: library(dplyr) library(digraphs) dygraph(data.in, main = "Title") %>% dySeries("ts.rmean", drawPoints = TRUE, color = "blue") %>% dySeries("ts.rmax", stepPlot = TRUE, fillGraph = TRUE, color = "red") %>% dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) It is possible to show on the x-axis

Is there a way to add legend next to a dygraph in R, not exactly on the plot?

穿精又带淫゛_ 提交于 2019-12-03 08:45:42
I'vw plotted a dygraph using a dygraph function from a dygraphs R package. I wonder is there a way to put legend next to the plot, not exactly on it like it is done by default... Code to reproduce this dygraph is below: library(archivist) library(dplyr) library(devtools) devtools::install_github("rstudio/dygraphs") library(dygraphs) seriesReactive <- loadFromGithubRepo( "db914a43536d4d3f00cf3df8bf236b4a", user= "MarcinKosinski", repo="Museum", value = TRUE) dygraph(seriesReactive, main = "Dzienna proporcja kliknięć do odsłon dla danych struktur", ylab = "Proporcja") %>% dyRangeSelector() Yes,

How can I get tooltips showing in dygraphs without annotation

元气小坏坏 提交于 2019-12-02 22:31:25
I am trying to use the R implementation of dygraphs The example provided is library(dygraphs) dygraph(presidents, main = "Presidential Approval") %>% dyAxis("y", valueRange = c(0, 100)) %>% dyAnnotation("1950-7-1", text = "A", tooltip = "Korea") %>% dyAnnotation("1965-1-1", text = "B", tooltip = "Vietnam") which results in the chart Hovering over the 'A' produces a tooltip with 'Korea' I am keen to have a tooltip for every point preferably dispensing entirely with the text requirement - though setting text to "" with minimal height/width values might suffice. I would also want to attach the

dyGraphs Second Y Axis not being displayed when using a variable as 'y2'

南笙酒味 提交于 2019-12-02 14:10:25
问题 I have the following code to display a graph with two axes. The data is of the form: Date, Value1, Value2 var sg = new Dygraph(document.getElemantById("div"), lGraphData, { labels: ['Date', string1, string2], legend: 'always', series: { string2 : { axis: 'y2' } }, ylabel: string1, y2label: string2 }); Instead of displaying the y2axis , both series appear on the graph and only y axis showing. If I replace string2 (a variable string) with Y2 in the above code, both axes appear. What am I doing

Shiny: calculate cumsum based on dygraphs' RangeSelector

久未见 提交于 2019-12-02 05:24:38
I'm building a shiny app where I want to plot a dataset with one of the variables being a cumulative sum of another variable. The latter needs to be re-calculated every time the start date of dygraphs ' dyRangeSelector changes. Below is a basic code without cumsum calculations. Commented out code is what I tried, with no success. library(shinydashboard) library(stringr) library(zoo) library(dplyr) library(dygraphs) ui <-dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( uiOutput("Ui1") ) ) server <- function(input, output, session) { output$Ui1 <- renderUI({ # date range

Horizontal line to show average in dygraph

谁说胖子不能爱 提交于 2019-12-01 18:49:24
I am trying to add a horizontal line to dygraph which already show my time series data. I have average of the complete data which I want to show as a static horizontal line on dygraph. Does anyone know how to do that simply. I already checked following links: http://dygraphs.com/tests/highlighted-region.html view-source: http://dygraphs.com/tests/crosshair.html There must be some simple solution to this user2916847 As danvk mentioned before , try specifying the "underlayCallback" option within your "new Dygraph()" call. Use HTML Canvas context to draw the line. Example below: (xmin and xmax

Scatter type graph in Dygraphs?

点点圈 提交于 2019-12-01 17:51:50
How can I plot a scatter graph using dygraphs. Data would be line the following. X axis might have 5-20 values (catagories) Y values might be 1-10 values per value on the x-axis This is an example of what i need. Is this possible in Dygraphs? Thanks Michael danvk You can set { strokeWidth: 0.0 } in the options to simulate a scatter plot (see http://dygraphs.com/options.html#strokeWidth ). You'll need the points as well: { drawPoints: true} These demos may be instructive: http://dygraphs.com/tests/linear-regression.html http://dygraphs.com/tests/linear-regression-addseries.html 来源: https:/

How to set specific y-axis label points in dygraphs?

*爱你&永不变心* 提交于 2019-11-30 22:50:42
Dygraphs ordinarily automatically picks Y- (and X-) axis labeling points based on the size of your axes, the size of the labels, etc. In some cases, it picks labeling points that lead to less clarity. For instance, on a chart with Y-axis values from 0 to 10, it labels at 0, 4, and 8 (for a certain size chart, at least); I'd like it to label at 0, 5, and 10. Is there an option or function I can provide to Dygraphs to specify what points I'd like labeled and ticked? You can do this by writing your own y-axis ticker function: http://dygraphs.com/options.html#ticker This is pretty advanced