r - 在R中的highchart内循环
问题描述
我必须自动分析 RStudio 上的数据集。
我的问题是我不知道数据集中会有多少系列。所以我想知道是否可以在 Highcharts 内部做一个 for 循环?
我不知道它不起作用是因为我做错了什么还是因为不可能。
output$hc2 <- renderHighchart ({
Hchc <- highchart(hcaes(x = Spring ,y = Ponctuation)) %>%
hc_title(text = "Cumulation of the result of a Team per spring",
margin = 20, align = "left",
style = list(color = "#FE8000", useHTML = TRUE)) %>%
hc_xAxis(categories = tableA$Spring, title = list(text = "Number of spring",color = "#FE8000")) %>%
hc_yAxis(title = list(text = "Cumulation of the result", color = "#FE8000"))%>%
for (i in length(mylist)){
hc_add_series(name = name[i], data = mylistcumu[[i]]$CumuPonct) }
print(Hchc)})
解决方案
我发现 !
output$hc2 <- renderHighchart ({
Hchc <- highchart(hcaes(x = Spring ,y = Ponctuation)) %>%
hc_title(text = "Cumulation of the result of a Team per spring",
margin = 20, align = "left",
style = list(color = "#FE8000", useHTML = TRUE)) %>%
hc_xAxis(categories = tableA$Spring, title = list(text = "Number of spring",color = "#FE8000")) %>%
hc_yAxis(title = list(text = "Cumulation of the result", color = "#FE8000"))
for (i in 1:length(mylist)){
Hchc <- Hchc %>%
hc_add_series(name = name[i], data = mylistcumu[[i]]$CumuPonct) }
Hchc})
推荐阅读
- c# - C# - 使用条件编写 ManagementEventWatcher 查询?
- sql - 安装后postgresql错误:与服务器的连接失败
- java - Netbeans JDK上的Glassfish服务器问题不是
- javascript - 查看是否处于严格模式
- directx - d3d11 无法在绘制顺序渲染目标之间更新常量缓冲区
- amazon-cloudformation - CloudFormation 创建初始 SSM 参数,但允许未来从 UI 控制台更新
- python - 如何向 S3 预签名 url 发出 python 请求并访问其内容?
- javascript - 将 cURL 命令转换为 http put 请求
- html - [HTML][Express] 在终端中使用 npm start 时应用程序崩溃
- javascript - Flask 应用程序:将 json 发布到服务器以在不同的 REST API 中使用