A function to create interactive gauge charts as well as output and render functions for using gauge within Shiny applications and interactive Rmd documents.
You can install gaugeR from github with:
# install.packages("devtools")
devtools::install_github("jumpingrivers/gaugeR")
This are some basic examples of the command gauge()
:
library(gaugeR)
gauge(0)
gauge(50)
gauge(1:4)
Here is a very basic shiny app example
## Only run this in interactive sessions
if(interactive()){
ui <- fluidPage(
titlePanel("Gauge Example!"),
sidebarLayout(
sidebarPanel(
sliderInput("obs",
"Pick a percentage",
min = 1,
max = 100,
value = 5)
),
mainPanel(
gaugeOutput("gaugePlot")
)
)
)
# Define the server code
server <- function(input, output) {
output$gaugePlot <- renderGauge({
gauge(input$obs)
})
}
shinyApp(ui = ui, server = server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.