【问题标题】:R - Markdown - Highcharter - Reduce size of plot in tableR - Markdown - Highcharter - 减小表格中的绘图大小
【发布时间】:2019-11-01 04:12:34
【问题描述】:

我试图在markdown 的表格中包含一个highcharter 图。我想要实现的是像https://www.highcharts.com/demo/sparkline 这样的想法(我曾尝试使用knitr::kableDT: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())` |

【问题讨论】:

标签: r highcharts r-markdown r-highcharter


【解决方案1】:

看看https://github.com/nuno-agostinho/Highcharter-in-DataTables 他们的代码对我来说效果很好。

【讨论】:

  • 谢谢。你可能有一个没有闪亮的可重复的小例子吗?
猜你喜欢
  • 1970-01-01
  • 2019-02-13
  • 2010-11-12
  • 1970-01-01
  • 2016-04-04
  • 2021-02-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多