在shinydashboard的菜单栏中不显示图表(带highcharter)
我已经连续几个小时试图让它工作,但它不工作。我只想在这个仪表板中呈现不同选项卡的图表。我已尝试使用renderHighchart2和highchartOutput2使用box()将其封闭起来。图表呈现的外部光泽很好,怎么了 编辑:我所指的图表是高度图表,而不是数值框!此外,该应用程序确实为每个图表显示了正确的标题,但fluidRow无法绘制高图表 代码如下:在shinydashboard的菜单栏中不显示图表(带highcharter),shiny,shinydashboard,r-highcharter,Shiny,Shinydashboard,R Highcharter,我已经连续几个小时试图让它工作,但它不工作。我只想在这个仪表板中呈现不同选项卡的图表。我已尝试使用renderHighchart2和highchartOutput2使用box()将其封闭起来。图表呈现的外部光泽很好,怎么了 编辑:我所指的图表是高度图表,而不是数值框!此外,该应用程序确实为每个图表显示了正确的标题,但fluidRow无法绘制高图表 代码如下: library(shiny) library(shinydashboard) library
library(shiny)
library(shinydashboard)
library(highcharter)
library(tidyverse)
ui <- dashboardPage(
skin = "purple",
dashboardHeader(title = h4(HTML("Generic company name<br/>Something to analyze")),
titleWidth = 275),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard",icon = icon("dashboard"),
menuSubItem('Samenvatting', tabName = "samenvatting", icon = icon('atlas')),
menuSubItem('Statusverloop', tabName = "statusverloop", icon = icon('battery-three-quarters')),
menuSubItem('Tijdsverloop', tabName = "tijdsverloop", icon = icon("hourglass-end")),
menuSubItem('Affiliates', tabName = "affiliates", icon = icon("handshake")),
menuSubItem('Klanten informatie', tabName = "klanteninformatie", icon = icon("address-card"))
),
menuItem("Kijkglas",tabname = "kijkglas",icon = icon("search"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = 'samenvatting',
#contents
fluidRow(
valueBoxOutput("YTDnieuweA"),
valueBoxOutput("YTDomvangA")
),
fluidRow(
valueBoxOutput("YTDnieuweP") ,
valueBoxOutput("YTDomvangP")
),
fluidRow(
column( width = 6,h4("Wekelijkse statistieken", align = 'center'), highchartOutput('a') ),
column( width = 6,h4("Wekelijkse totale statistieken", align = 'center'), highchartOutput('b'))
)
),
tabItem(tabName = "statusverloop"
#Empty TODO:
),
tabItem(tabName = "tijdsverloop"
#EMPTY: TODO
),
tabItem(tabName = "affiliates",
fluidRow(
column( width = 6,h4("Affiliates over aanmeldingen", align = 'center'), highchartOutput('a') ),
column( width = 6,h4("Affiliates over passen", align = 'center'), highchartOutput('b'))
)
),
tabItem(tabName = "klanteninformatie",
fluidRow(
column( width = 4,h4("Wekelijkse statistieken", align = 'center'), highchartOutput('a') ),
column( width = 4,h4("Wekelijkse totale statistieken", align = 'center'), highchartOutput('b')),
column( width = 4,h4("Wekelijkse totale statistieken", align = 'center'), highchartOutput('a'))
)
)
)
)
)
server <- function(input, output) {
output$a <- renderHighchart2({
hc <- highcharts_demo() %>%
hc_rm_series("Berlin") %>%
hc_chart(type = 'line')
theme <- sandsignika = hc_theme_sandsignika()
hc <- hc %>% hc_add_theme(theme)
}
hc
})
output$b <- renderHighchart2({
hc <- highcharts_demo() %>%
hc_rm_series("Berlin") %>%
hc_chart(type = 'line')
theme <- hc_theme_economist()
hc <- hc %>% hc_add_theme(theme)
}
hc
})
}
shinyApp(ui,server)
库(闪亮)
图书馆(shinydashboard)
图书馆(高级特许)
图书馆(tidyverse)
ui在shinny中,您不能在ui中多次引用任何输出
尝试将图表存储在一个对象中(可以使用reactiveValues
或reactive()
来存储它),然后将该对象分配到单独的输出中。在shiny中,您不能在UI中多次引用任何输出
尝试将图表存储在对象中(可以使用reactiveValues
或reactive()
存储图表),然后将该对象分配到单独的输出中。这很有效,非常感谢!我被困在这上面好几个小时了!我去过那里。真的希望shiny会抛出一个错误,而不仅仅是让大部分UI消失……这很有效,非常感谢!我被困在这上面好几个小时了!我去过那里。真的希望shiny会抛出一个错误,而不仅仅是让大部分UI消失。。。