【问题标题】:Loop inside highchart in R在R中的highchart内循环
【发布时间】:2019-09-25 23:46:03
【问题描述】:

我必须在 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)})

【问题讨论】:

    标签: r loops highcharts rstudio shinydashboard


    【解决方案1】:

    我找到了!

    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})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多