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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
library(shiny)
library(shinydashboard)
library(googleVis)
df <- data.frame(
y = rep("fffffffffffffffffffffffffffffffffffffffffffffffffffffff", 10),
x = rep(1,10)
)
ui <- dashboardPage(
dashboardHeader(title = "google vis"),
dashboardSidebar(disable = TRUE),
dashboardBody(
fluidRow(
box(
status = "primary",
width = 11, height = 500,
htmlOutput("gvis")
),
# fake plot to rescale
box(
status = "warning",
width = 1,
plotOutput("toto")
)
)
)
)
server <- function(input, output, session) {
output$gvis <- renderGvis({
# to rescale the plot
session$clientData$output_toto_width
# draw the plot
gvisPieChart(chartid = "test", df,
options = list(
title = 'Répartion des ventes produits',
legend = "{position: 'left', textStyle: {color: 'blue', fontSize: 12}}",
pieSliceText = 'label',
pieHole = 0.2, width = "100%", height = "500"
)
)
})
} |
Partager