Description Usage Arguments Value Note Examples
Define a text annotation for a data-point on a dygraph chart.
1 2 3 4 |
dygraph |
Dygraph to add an annotation to |
x |
Either numeric or date value indicating where to place the
annotation. For date value, this should be of class |
text |
Text to overlay on the chart at the location of x |
tooltip |
Additional tooltip text to display on mouse hover |
width |
Width (in pixels) of the annotation flag. |
height |
Height (in pixels) of the annotation flag. |
cssClass |
CSS class to use for styling the annotation. |
tickHeight |
Height of the tick mark (in pixels) connecting the point to its flag or icon. |
attachAtBottom |
If true, attach annotations to the x-axis, rather than to actual points. |
clickHandler |
JavaScript function to call when an annotation is clicked. |
mouseOverHandler |
JavaScript function to call when the mouse hovers over an annotation. |
mouseOutHandler |
JavaScript function to call when the mouse exits an annotation. |
dblClickHandler |
JavaScript function to call when an annotation is double clicked. |
series |
Series to attach the annotation to. By default, the last series
defined using |
Dygraph with specified annotation
Annotations are bound to specific series in the input data. If you have
only one series or if you define annotations immediately after a call to
dySeries
then you need not specify the series explicitly.
Otherwise, you should use the series
parameter to indicate which
series the annotation should be bound to.
Annotation event handlers can also specified globally (see
dyCallbacks
).
See the online documentation for additional details and examples.
1 2 3 4 5 6 7 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.