View source: R/FrissC3Charts.R
Friss custom c3.js HTMLWidget output binding
1 2 3 4 5 | FrissC3BarChart(Data = data.frame(suspected = c(10, 8, 11), investigated =
c(6, 9, 1), suspicious = c(7, 9, 12), proven = c(2, 3, 25), row.names =
c("actual", "planned", "average")), yUnit = "", width = "100%",
height = "500px", padding = list(top = 40, right = 100, bottom = 40, left
= 100), rotated = FALSE, legend_show = TRUE, legend_position = "bottom")
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | app <- shinyApp(
ui = fluidPage(
actionButton("Update","Update"),
FrissC3BarChartOutput("Chart")
),
server = function(input, output) {
output$Chart <- renderFrissC3BarChart({
cat("\nUpdate")
input$Update
Data <- data.frame(suspected = runif(3,8,11), investigated =
c(6, 9, 1), suspicious = c(7, 9, 12), proven = c(2, 3, 25), row.names =
c("actual", "planned", "average"))
# make number of columns data change
if(input$Update %% 2 == 0) Columns <- 2:3
else Columns <- 1:3
Data <- Data[,Columns]
FrissC3BarChart(Data = Data, yUnit = "", width = "100%",
height = "500px", padding = list(top = 40, right = 100, bottom = 40, left
= 100), rotated = FALSE, legend_show = TRUE, legend_position = "bottom")
})
}
)
runApp(app)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.