View chart

Column

Chart A-1

Chart A-2

Column

Chart B

Chart C

Data - Table

Column

Mô tả

Đây là bộ dữ liệu “mtcars” trong gói “datasets” Motor Trend Car Road Tests

Column

Table

Other

Column

Valuebox

75

Gauge

Column

Valuebox

20

Gauge

Column

Valuebox

50

Gauge

---
title: "Test Flex dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
data(mpg, package = "ggplot2")
library(dplyr)

```

View chart
===================

Column {data-width=700 .tabset}
-----------------------------------------------------------------------

### Chart A-1

```{r}
library(highcharter)
hchart(cor(mtcars))
```

### Chart A-2
```{r}
library(rbokeh)
p <- figure() %>%
  ly_points(Sepal.Length, Sepal.Width, data = iris,
    color = Species, glyph = Species,
    hover = list(Sepal.Length, Sepal.Width))
p
```

Column {data-width=300}
-----------------------------------------------------------------------

### Chart B

```{r include=FALSE}
mpgman2 <- mpg %>% 
  count(class, year) %>% 
  glimpse()
```


```{r message=FALSE, warning=FALSE}
hchart(mpgman2, "column", hcaes(x = class, y = n, group = year))
```

### Chart C

```{r}

library(highcharter)
highchart() %>% 
  hc_title(text = "Scatter chart with size and color") %>% 
  hc_add_series_scatter(mtcars$wt, mtcars$mpg,
                        mtcars$drat, mtcars$hp)
```


Data - Table
==========================
Column {data-width=200}
--------------------------
### Mô tả

Đây là bộ dữ liệu "mtcars" trong gói "datasets"
**Motor Trend Car Road Tests**

Column {data-width=800}
--------------------------

### Table

```{r}
datatable(
  mtcars, rownames = FALSE,
  extensions = 'Buttons', options = list(
    dom = 'Bfrtip',
    buttons = c('copy', 'csv', 'excel', 'pdf', 'print')
  )
)
```


Other
==========================

Column {data-width=300}
--------------------------

### Valuebox
```{r}
valueBox(75 , 
         caption = 'Percent complete', 
         icon = 'fa-battery-three-quarters')
```

### Gauge

```{r}
gauge(value = 75,
      min = 0,
      max = 100,
      sectors = gaugeSectors(success = c(65, 100),
                             warning = c(30, 65),
                             danger = c(0, 30)))	
```

Column {data-width=300}
--------------------------

### Valuebox
```{r}
valueBox(20 , 
         caption = 'Percent complete', 
         icon = 'fa-battery-quarter')
```

### Gauge

```{r}
gauge(value = 20,
      min = 0,
      max = 100,
      sectors = gaugeSectors(success = c(65, 100),
                             warning = c(30, 65),
                             danger = c(0, 30)))	
```

Column {data-width=300}
--------------------------

### Valuebox
```{r}
valueBox(50 , 
         caption = 'Percent complete', 
         icon = 'fa-battery-half')
```

### Gauge

```{r}
gauge(value = 50,
      min = 0,
      max = 100,
      sectors = gaugeSectors(success = c(65, 100),
                             warning = c(30, 65),
                             danger = c(0, 30)))	
```