Skip to content

Instantly share code, notes, and snippets.

@bearloga
Created August 5, 2016 17:48
Show Gist options
  • Save bearloga/a87ec1e850ee313897b5a3126d131e37 to your computer and use it in GitHub Desktop.
Save bearloga/a87ec1e850ee313897b5a3126d131e37 to your computer and use it in GitHub Desktop.
---
title: "dyEvent Example"
output:
html_document:
css: style.css
---
```{r setup, echo = FALSE, warning = FALSE, message = FALSE}
library(xts)
library(dygraphs)
knitr::opts_chunk$set(echo = FALSE)
```
```{r data}
example <- xts(data.frame(data = cumsum(rnorm(90))), order.by = seq(Sys.Date() - 90, Sys.Date() - 1, "day"))
```
```{r dygraph}
dygraph(example, main = "Random Walk") %>%
dyCSS("style.css") %>%
dyEvent(Sys.Date() - 7, "Last week", color = "white")
```
body {
color: white;
background-color: black;
}
.dygraph-title {
color: white;
font-weight: bold;
}
.dygraph-axis-label {
color: white;
}
.dygraph-legend {
color: black;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment