rCharts和slidy将宽度设置为100%?

时间:2015-04-12 20:21:51

标签: r rcharts

是否可以在rcharts上动态调整?

现在我有

---
title: "Test"
author: "my name"
output:
  slidy_presentation:
    incremental: yes
---

## Slide with rCharts

```{r, comment = NA, results = "asis", tidy = F, echo=F}
library(rCharts)
hair_eye_male <- subset(as.data.frame(HairEyeColor), Sex == "Male")
n1 <- nPlot(Freq ~ Hair, group = "Eye", data = hair_eye_male, type = "multiBarChart")
n1$set(width = 1024)
n1$show('iframesrc', cdn = TRUE)
```

我尝试了n1$set(width = 100%),但这不起作用

1 个答案:

答案 0 :(得分:0)

我相信rCharts你只能设置宽度和高度(以像素为单位)(px)。

library(rCharts)
hair_eye_male <- subset(as.data.frame(HairEyeColor), Sex == "Male")
n1 <- nPlot(Freq ~ Hair, group = "Eye", data = hair_eye_male, type = "multiBarChart", width = 1024)
n1$show('iframesrc', cdn = TRUE)

我个人在html文档中手动更改它。