File: dyEvent.Rd

package info (click to toggle)
r-cran-dygraphs 1.1.1.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,232 kB
  • sloc: javascript: 10,787; sh: 19; makefile: 15
file content (52 lines) | stat: -rw-r--r-- 1,730 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/event.R
\name{dyEvent}
\alias{dyEvent}
\title{dygraph event line}
\usage{
dyEvent(dygraph, x, label = NULL, labelLoc = c("top", "bottom"),
  color = "black", strokePattern = "dashed", date)
}
\arguments{
\item{dygraph}{Dygraph to add event line to}

\item{x}{Either numeric or date/time for the event, depending on the format
of the x-axis of the dygraph. (For date/time must be a \code{POSIXct}
object or another object convertible to \code{POSIXct} via
\code{as.POSIXct})}

\item{label}{Label for event. Defaults to blank.}

\item{labelLoc}{Location for label (top or bottom)}

\item{color}{Color of event line. This can be of the form "#AABBCC" or 
"rgb(255,100,200)" or "yellow". Defaults to black.}

\item{strokePattern}{A predefined stroke pattern type ("dotted", "dashed",
"dotdash", or "solid") or a custom pattern array where the even index is 
a draw and odd is a space in pixels. Defaults to dashed.}

\item{date}{(deprecated) See argument \code{x}.}
}
\value{
A dygraph with the specified event line.
}
\description{
Add a vertical event line to a dygraph
}
\note{
See the \href{https://rstudio.github.io/dygraphs/gallery-event-lines.html}{online 
  documentation} for additional details and examples.
}
\examples{
library(dygraphs)

dygraph(presidents, main = "Presidential Approval") \%>\%
  dyAxis("y", valueRange = c(0, 100)) \%>\%
  dyEvent("1950-6-30", "Korea", labelLoc = "bottom") \%>\%
  dyEvent("1965-2-09", "Vietnam", labelLoc = "bottom")
dygraph(presidents, main = "Presidential Approval") \%>\%
  dyAxis("y", valueRange = c(0, 100)) \%>\%
  dyEvent(c("1950-6-30", "1965-2-09"), c("Korea", "Vietnam"), labelLoc = "bottom") 
 
}