Created
September 14, 2016 19:34
-
-
Save Tutuchan/28f6ac4b38a60ffd93b3e80133d863dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "loop over widgets" | |
author: "Tutuchan" | |
date: "14 septembre 2016" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
library(chartjs) | |
library(knitr) | |
``` | |
```{r} | |
plot_list <- lapply(1:2, function(i) { | |
chartjs(height = "200px") %>% | |
cjsBar(labels = LETTERS[1:10]) %>% | |
cjsSeries(data = c(abs(c(rnorm(8))), NA, 0.5), label = "Series 1") %>% | |
cjsSeries(data = abs(c(rnorm(10))), label = "Series 2") %>% | |
cjsSeries(data = abs(c(rnorm(10))), label = "Series 3") %>% | |
cjsTitle(title = paste("Chart", i)) %>% | |
cjsLegend() | |
}) | |
``` | |
```{r} | |
htmltools::tagList(plot_list) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome!