我正在尝试在highcharter
中的表格中包含markdown
图。我想实现的是类似https://www.highcharts.com/demo/sparkline的想法(我曾尝试使用knitr::kable
和DT:datatable
来代替成功)
是否可以更改地块的高度?hc_size()
/ highcharter()
均无效。
---
title: "Title"
author: "Author"
date: "Date"
output:
flexdashboard::flex_dashboard:
self_contained: no
orientation: row
vertical_layout: scroll
---
```{r, message=F, warning=F, echo=F}
library(flexdashboard)
library(highcharter)
library(tidyverse)
```
DB {data-orientation=rows}
=======================================================================
```{r}
h1 <- hc_size(hchart(data.frame(x = 1:10, y = rnorm(10)), type = "line", mapping = hcaes(x = x, y = y)), 1,1)
h2 <- hchart(data.frame(x = 1:10, y = rnorm(10)), type = "line", mapping = hcaes(x = x, y = y))
```
Row {data-width=600 data-height=1500}
-----------------------------------------------------------------------
### {data-height=1000 data-width=400}
|<font size="4">**A**</font> |<font size="4">B</font> | <font size="4">C</font> | <font size="4">D</font> | <font size="4">E</font> | <font size="4">F</font> | <font size="4">G</font> |
|:-------------------|:----:|:-----------: |:----: |:----:|:-------------------- |:----:
| | | <br> <font size="3">**AA**</font> | | |
|A | B | C | D | E | F | `r h1 %>% hc_add_theme(hc_theme_sparkline())` |
|A | B | C | D | E | F | `r hc_size(h2 %>% hc_add_theme(hc_theme_sparkline()), 1, 1)` |
|A | B | C | D | E | F | `r highchart(width = 1, height = 1) %>% hc_add_series(data.frame(x = 1:10, y = rnorm(10)), type = "line", mapping = hcaes(x = x, y = y)) %>% hc_add_theme(hc_theme_sparkline())` |
看看https://github.com/nuno-agostinho/Highcharter-in-DataTables他们的代码对我来说相当不错。