2017-10-13 14 views
0

내 반짝이는 응용 프로그램에 문제가 있습니다. flexdashboard 패키지에서 gauge을 소개하기 전에 내 응용 프로그램은 valueBox이 정상적으로 작동했습니다.R 반짝이 값 상자와 계기가 함께 작동하지 않습니다.

gauge을 사용하면 my valueBox가 더 이상 UI에서 렌더링되지 않습니다.

다른 게시물을 읽는 중, 이것이 flexdashboard 패키지의 문제라고 생각합니다.

모든 해결 방법을 알려 주시면 감사하겠습니다. 아래

일부 재현 코드 :

library(shiny) 
library(shinydashboard) 
#library(flexdashboard) 


ui <-dashboardPage(
dashboardHeader(), 
dashboardSidebar(), 
dashboardBody(
fluidRow(
    valueBoxOutput("vbox1"), 
    column(6,box(plotOutput("plt1"),width=12,title="Gauge Graph",background ="green")), 

column(6,box(plotOutput("plt2"),width=12,title="Graph2",background="yellow")) 
), 
fluidRow(actionButton("plot","plot")) 
) 
) 

server <- shinyServer(function(input, output, session) { 
observeEvent(input$plot,{ 
output$plt1 <- renderPlot({ 
    flexdashboard::gauge(56, min = 0, max = 100, symbol = '%', label = paste("Test Label"),gaugeSectors(
    success = c(100, 6), warning = c(5,1), danger = c(0, 1), colors = c("#CC6699") 
)) 

}) 
output$plt2 <- renderPlot({plot(runif(100),runif(100))}) 
}) 

output$vbox1 <- renderValueBox({ 
valueBox(
    "Gender", 
    input$count, 
    icon = icon("users") 
) 
}) 
}) 

shinyApp(ui = ui, server = server) 
+0

https://www.rdocumentation.org/packages/flexdashboard/versions/0.4/topics/gauge-shiny –

답변

1

대신 라이브러리를 소싱의 flexdashboard 네임 스페이스를 사용할 수 있습니다.

은 당신이 뭔가를 할 수 있습니다 :

library(shiny) 
library(shinydashboard) 
# library(flexdashboard) 


ui <-dashboardPage(
    dashboardHeader(), 
    dashboardSidebar(), 
    dashboardBody(
    fluidRow(
     valueBoxOutput("vbox1"), 
     column(6,box(flexdashboard::gaugeOutput("plt1"),width=12,title="Gauge Graph",background ="green")), 

     column(6,box(plotOutput("plt2"),width=12,title="Graph2",background="yellow")) 
    ), 
    fluidRow(actionButton("plot","plot")) 
) 
) 

server <- shinyServer(function(input, output, session) { 
    observeEvent(input$plot,{ 
    output$plt1 <- flexdashboard::renderGauge({ 
     flexdashboard::gauge(56, min = 0, max = 100, symbol = '%', label = paste("Test Label"), 
          flexdashboard::gaugeSectors(success = c(100, 6), warning = c(5,1), danger = c(0, 1), colors = c("#CC6699") 
    )) 

    }) 
    output$plt2 <- renderPlot({plot(runif(100),runif(100))}) 
    }) 

    output$vbox1 <- renderValueBox({ 
    valueBox(
     "Gender", 
     input$count, 
     icon = icon("users") 
    ) 
    }) 
}) 

shinyApp(ui = ui, server = server) 

응용 프로그램은 다음과 같습니다이 코드를 사용 : enter image description here

가 도움이 희망을!