【发布时间】:2016-02-26 00:26:18
【问题描述】:
我正在尝试在reveal.js 演示文稿中构建一些Highchart(包HighCharter)。
现在我正在根据page 改编蜘蛛网图表。
这是我的代码:
```{r, echo=FALSE, message=FALSE, results = 'asis', comment = NA}
library("highcharter")
library(magrittr)
gg<- highchart() %>%
hc_chart(polar = TRUE, type = "line") %>%
hc_title(text = "Where do you usually buy solar protection products? (%)") %>%
hc_subtitle(text = "Move the mouse pointer on the spiderweb chart to view the data") %>%
hc_xAxis(categories = c('Supermarket',
'Department Store',
'Pharmacy',
'Perfumery',
'Herbalist',
'Internet',
'Shop for Personal Care'
),
tickmarkPlacement = 'on',
lineWidth = 0) %>%
hc_yAxis(gridLineInterpolation = 'polygon',
lineWidth = 0,
min = 0) %>%
hc_series(
list(
name = "Male (%)",
data = c(14.3,
9.1,
35.8,
26.3,
4.9,
4.6,
4.1
),
pointPlacement = 'on', color="#88C425"
),
list(
name = "Female (%)",
data = c(17.0,
7.0,
40.2,
28.8,
18.3,
2.2,
3.6
),
pointPlacement = 'on', color="#A8DBA8"
)
)
gg$show("inline", include_assets = TRUE)
```
好吧,代码在正常的 sintax 中可以正常工作,但是我将它包含在 RMarkdown sintax 中,结果是一个错误:
Error in eval(expr, envir, enclos) :
tentativo di applicare una non-funzione
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
有人可以帮忙吗?
【问题讨论】:
-
嗨!为什么使用 gg$show() 而不是 gg? Highcharter没有show方法!编辑:我现在看到我也不能在 r 演示文稿中使用图表。我会检查
-
嗨@jbkunst,实际上我尝试了'gg'并且没有创建任何对象......但是这些解决方案在演示文稿中不起作用。感谢您的帮助
-
嗨@jbkunst,你有没有机会看看你是否可以在演示文稿中放置一个Highchart?如果我们不能因为它们看起来很好,那就太可惜了。提前致谢
标签: r highcharts r-markdown reveal.js