Title: | Additional Functions to be Used with dygraph-Objects |
---|---|
Description: | Additional functions to be used with dygraph-objects e.g. shading of areas or drawing of lines representing time periods within events (given by begin and end times). |
Authors: | Hauke Sonnenberg [aut, cre] , Michael Rustler [ctb] , FAKIN [fnd], KURAS [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph] |
Maintainer: | Hauke Sonnenberg <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-10-29 04:01:34 UTC |
Source: | https://github.com/KWB-R/kwb.dygraph |
add lines to dygrap plot representing begin and end of events
addEventLines( dygraph, events, labels = seq_len(nrow(events)), color = "red", labelLoc = "top", color.begin = color, color.end = color, labelLoc.begin = labelLoc, labelLoc.end = labelLoc, signalWidth = kwb.event::hsSigWidth(events) )
addEventLines( dygraph, events, labels = seq_len(nrow(events)), color = "red", labelLoc = "top", color.begin = color, color.end = color, labelLoc.begin = labelLoc, labelLoc.end = labelLoc, signalWidth = kwb.event::hsSigWidth(events) )
dygraph |
dygraph object as returned by dygraph |
events |
data frame with columns tBeg (begin time) and tEnd (end time) of events to be drawn |
labels |
labels given to the events (default: |
color |
color (default: "red") |
labelLoc |
"top" or "bottom" (default: "top") |
color.begin |
default: same as argument "color" |
color.end |
default: same as argument "color" |
labelLoc.begin |
default: same as argument "labelLoc" |
labelLoc.end |
default: same as argument "labelLoc" |
signalWidth |
signal width in seconds = length of time interval that one timestamp in the original data represents, e.g. 300 for 5-minutes-data. |
modified dygraph object
add shaded areas representing time intervals within "events"
addEventShades( dygraph, events, color = "lightgrey", signalWidth = kwb.event::hsSigWidth(events) )
addEventShades( dygraph, events, color = "lightgrey", signalWidth = kwb.event::hsSigWidth(events) )
dygraph |
dygraph object as returned by dygraph |
events |
data frame with columns tBeg (begin time) and tEnd (end time) of events to be drawn |
color |
color (default: "lightgrey") |
signalWidth |
signal width in seconds = length of time interval that one timestamp in the original data represents, e.g. 300 for 5-minutes-data |
modified dygraph object
call dygraphs::dyEvent repeatedly
dyEvents( dygraph, dates, labels = "", labelLocs = c("top", "bottom"), colors = "black", strokePatterns = "dashed" )
dyEvents( dygraph, dates, labels = "", labelLocs = c("top", "bottom"), colors = "black", strokePatterns = "dashed" )
dygraph |
Dygraph to add event line to |
dates |
vector of Date/time for the event (must be a POSIXct object or another object convertible to POSIXct via as.POSIXct) |
labels |
vector of labels for the events. (default: "") |
labelLocs |
vector of locations for the labels ("top" or "bottom"). default: c("top", "bottom") |
colors |
vector of colors for each event line. This can be of the form "#AABBCC" or "rgb(255,100,200)" or "yellow". Defaults to black. |
strokePatterns |
vector of predefined stroke pattern types ("dotted", "dashed", or "dotdash") |
modified dygraph object