Package 'kwb.dygraph'

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

Help Index


add lines to dygrap plot representing begin and end of events

Description

add lines to dygrap plot representing begin and end of events

Usage

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)
)

Arguments

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: 1:nrow(events))

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.

Value

modified dygraph object


add shaded areas representing time intervals within "events"

Description

add shaded areas representing time intervals within "events"

Usage

addEventShades(
  dygraph,
  events,
  color = "lightgrey",
  signalWidth = kwb.event::hsSigWidth(events)
)

Arguments

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

Value

modified dygraph object


call dygraphs::dyEvent repeatedly

Description

call dygraphs::dyEvent repeatedly

Usage

dyEvents(
  dygraph,
  dates,
  labels = "",
  labelLocs = c("top", "bottom"),
  colors = "black",
  strokePatterns = "dashed"
)

Arguments

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")

Value

modified dygraph object