dygraphs

R Shiny application: Modifying plot without re-rendering it

可紊 提交于 2019-12-07 12:46:34
问题 I've been looking into ways to update a plot within an R Shiny application without having to re-render the whole plot. I'm working with temporal data which is animated via a Slider Input ( animationOptions(playButton = TRUE) ). The idea is to somehow highlight the part of the plot which is selected via the Slider Input . Re-rendering the whole plot at every animation step would make the whole application uselessly slow. The most elegant solution with ggplot2 would have been, if shiny offered

dyLimit for limited time in Dygraphs

时光总嘲笑我的痴心妄想 提交于 2019-12-06 23:32:16
问题 I'm trying to draw a dygraph plot (barplot thanks to the answer to Create a barplot in R using dygraphs package) with two horizontal lines , but not ranging the whole OX axis . What I have now is: And what I would like to have is: The only think I know how to get is (but that is not what I want): Does anybody know is it possible to obtain my goal? I'd be greatfull for any help! My code to reproduce the plot: library("dplyr") library("data.table") library("dygraphs") library("htmlwidgets") #

Plain Dygraphs JavaScript options in R/Shiny

醉酒当歌 提交于 2019-12-06 13:49:23
问题 Is there a way to use plain Dygraphs JavaScript options in R (and Shiny more in specific)? http://dygraphs.com/options.html I think the JS() function from the htmlwidgets package can be of use, but am not sure. For example, I want to use highlightSeriesOpts (cf. first link) to highlight individual series in a dygraphs plot in order to display ONLY the selected series in the legend (and not all series at the same time by default). The lower 2 plots in the following link show exactly what is to

dygraph vertical line

冷暖自知 提交于 2019-12-06 09:03:27
Is there a way to make a vertical line in the js graph library dygraph? I am loading data and would like to put vertical lines like graphite does to show events is there some special context to add vertical lines You've probably figured this out by now, or stopped caring, but the way to do this is with a custom underlay (see http://dygraphs.com/tests/highlighted-region.html and http://dygraphs.com/tests/underlay-callback.html for examples). You provide an underlayCallback function when creating the graph, and it gets called with the canvas element, area (which helps with coordinate math), and

How to format date and time in Dygraphs legend according to user locale

a 夏天 提交于 2019-12-06 08:16:14
I have a graph that displays a device's power output over time and I'd like to format the legend so that it displays the timestamps in the style of where the current user is (for example, in the US it would show MM/DD/YY h:m:s am/pm , and in EU would show DD/MM/YYYY HH:MM:SS , etc.). Currently, it's set at default, as follows: I pass in a JS Date() object for the x-axis and I've found that you can modify the x-axis labels , but I can't find any info on changing the format of the legend when hovering over the graph. You've discovered the axisLabelFormatter option, which lets you control

Browser crashes after 10-15 mins

喜你入骨 提交于 2019-12-06 07:32:58
In my app I'm displaying 10 charts (charts are from dygraphs .) to monitor data. For displaying charts I'm getting data from my sever by sending ajax request to 4 servlets on every 5 seconds. After 10-15 mins (don't know exact time.) my browser crashes saying "aw!! snap." What could be the reason? Is it javascript that is causing it? or is it because I'm sending request every 5 seconds? Browser tested: Firefox and Chorme. Note:- When I refresh the browser after crash it again works fine for 10-15 mins. JS code: var i=0; var loc = new String(); var conn = new String(); var heapUsage = new

R How to shade week-end period with dygraphs?

怎甘沉沦 提交于 2019-12-06 04:17:41
问题 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

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

你离开我真会死。 提交于 2019-12-06 03:29:15
问题 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. 回答1: 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.

Displaying multiple dygraphs on a grid in R-Markdown

房东的猫 提交于 2019-12-06 03:24:46
Following the conversation here , is there a way to organize the output dygraphs in a grid? To Have one or more graph in a row. The code below would generate 4 dygraphs arranged vertically. Is there a way to organize them in a 4x4 grid? I tried using tags$div but it wraps all the graphs in one div. Is there a way to apply a CSS property such as display: inline-block; to each dygraph widget? or any other better method? ```{r} library(dygraphs) library(htmltools) makeGraphs = function(i){ dygraph(lungDeaths[, i], width = 300, height = 300, group = "lung-deaths")%>% dyOptions(strokeWidth = 3) %>%

R Shiny application: Modifying plot without re-rendering it

不羁的心 提交于 2019-12-05 21:36:56
I've been looking into ways to update a plot within an R Shiny application without having to re-render the whole plot. I'm working with temporal data which is animated via a Slider Input ( animationOptions(playButton = TRUE) ). The idea is to somehow highlight the part of the plot which is selected via the Slider Input . Re-rendering the whole plot at every animation step would make the whole application uselessly slow. The most elegant solution with ggplot2 would have been, if shiny offered a way to add layers to the ggplot (e.g. + geom line() ) and integrated this layer seamlessly into the