library(highcharter)
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
data <- data_frame(
value = rnorm(100),
group = sample(1:5, size = length(value), replace = TRUE)
)
series <- data %>%
group_by(name = group) %>%
do(data = cumsum(.$value)) %>% # here you format your data if this is a bar o time series
ungroup() %>%
mutate(lineWidth = runif(nrow(.))*5 + 1,
type = "line",
color = colorize(lineWidth))
series
## # A tibble: 5 × 5
## name data lineWidth type color
## <int> <list> <dbl> <chr> <chr>
## 1 1 <dbl [22]> 3.656616 line #324870
## 2 2 <dbl [16]> 1.841722 line #440154
## 3 3 <dbl [19]> 3.875214 line #21908C
## 4 4 <dbl [21]> 5.814315 line #FDE725
## 5 5 <dbl [22]> 5.111909 line #8FBB58
series <- list_parse(series)
highchart() %>%
hc_add_series_list(series) %>%
hc_add_theme(hc_theme_smpl()) %>%
hc_plotOptions(series = list(marker = list(enabled = FALSE)))