2016-07-28 30 views
0

Ich versuche ein gauge plot in ShinyDashBoard zu plotten und ich sehe zwei Probleme.flexdashboard: Messgerätplot rendert nicht in ShinyDashBoard und korrumpiert die ValueBox

1) Das Messgerät Grundstück nicht

2) nicht machen es verdirbt irgendwie die ValueBox im Armaturenbrett.

Unten ist der Code, um dieses Problem zu replizieren.

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) 

Auch Plots erzeugt plotly Bibliothek :-( mit Jede Hilfe dieses Problem auf die Lösung sehr geschätzt wird. Vielen Dank im Voraus.

+0

Sie eine Lösung gefunden? – user3463225

Antwort

0

Ich lief in das gleiche Problem!

Es ist eine Sache UI - Sehen Sie sich Ihren Code an, wenn Sie die Serverausgabe aufrufen.Sie sollten flexdashboard::gaugeOutput("plt1") anstelle von plotlyOutput verwenden.Das sollte das Problem lösen

Referenz: https://cran.r-project.org/web/packages/flexdashboard/flexdashboard.pdf (d.h. nur die flexdashboard Paketseite).

-1

1.In UI

column(6,box(gaugeOutput("plt1"),width=12,title="Gauge Graph",background ="green")) 

In Server

output$plt1 <- renderGauge({ 
     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") 
    )) 
    }) 

2.

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