Created
April 26, 2016 15:38
-
-
Save ThoDuyNguyen/687a94f12d926dd650c6073d2b94f61b 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: "Flex Dashboard" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: fill | |
horizontal_layout: fill | |
--- | |
```{r setup, include=FALSE} | |
# Load packages and initialize data here | |
library(flexdashboard) | |
library(chartjs) | |
``` | |
Bars Chart | |
======================================= | |
### Bar Chart | |
```{r} | |
chartjs() %>% | |
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") %>% | |
cjsLegend() %>% | |
cjsTitle("Bar Chart", fontSize = 30) | |
``` | |
Line Chart | |
======================================= | |
### Line Chart | |
```{r} | |
chartjs() %>% | |
cjsLine(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") %>% | |
cjsLegend() %>% | |
cjsTitle("Line Chart", fontSize = 30) | |
``` | |
Pie Chart | |
======================================= | |
### Pie Chart | |
```{r} | |
chartjs() %>% | |
cjsPie(labels = LETTERS[1:4]) %>% | |
cjsSeries(data = abs(c(rnorm(4)))) %>% | |
cjsLegend() %>% | |
cjsTitle("Pie Chart", fontSize = 30) | |
``` | |
Doughnut Chart | |
======================================= | |
### Doughnut Chart | |
```{r} | |
chartjs() %>% | |
cjsDoughnut(labels = LETTERS[1:4]) %>% | |
cjsSeries(data = abs(c(rnorm(4)))) %>% | |
cjsLegend() %>% | |
cjsTitle("Doughnut Chart", fontSize = 30) | |
``` | |
Radar Chart | |
======================================= | |
### Radar Chart | |
```{r} | |
chartjs() %>% | |
cjsRadar(labels = c("Strength", "Perception", "Endurance", "Charisma", "Intelligence", "Agility", "Luck")) %>% | |
cjsSeries(data = c(10, 4, 10, 2, 4, 6, 8)) %>% | |
cjsSeries(data = c(4, 8, 5, 8, 7, 7, 5)) %>% | |
cjsEditScale(axis = NULL, ticks = list(beginAtZero = TRUE)) %>% | |
cjsLegend() %>% | |
cjsTitle("Radar Chart", fontSize = 30) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment