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
|
library(shiny)
# Define server logic required to draw a histogram
shinyServer <-
(function(input, output)
{
--- ici intervient mon fichier R qui fonctionne correctement----
output$graph <- renderPlot
({
Choice <- reactive({rexp(input$Choice)})
if (as_tibble(Choice()) == "n")
{
ggplot (CountNotePerAgentdf, aes(x=YandQ, y=Count))+
geom_bar(stat="identity",position="dodge",fill='#3333FF', width =.4 )+ # identity means that both x and y values are from the dataframe
facet_grid(.~ Agent)+
labs (title = "Number of SHR Note by Agent and by Quarter", x = "Year and Quarter", y = "Count of SHR Note")+ # to show the title
theme(axis.text.x = element_text(angle=45)) # to incline the labels at 45 degrees
}
if (as_tibble(Choice()) == "e")
{
ggplot (CountEmailPerAgentdf, aes(x=YandQ, y=Count))+
geom_bar(stat="identity",position="dodge",fill='#3333FF', width =.4 )+ # identity means that both x and y values are from the dataframe
facet_grid(.~ Agent)+
labs (title = "Number of SHR Email by Agent and by Quarter", x = "Year and Quarter", y = "Count of SHR Email")+ # to show the title
theme(axis.text.x = element_text(angle=45)) # to incline the labels at 45 degrees
}
if (as_tibble(Choice())== "s")
{
ggplot (CountSRPerAgentdf, aes(x=YandQ, y=Count))+
geom_bar(stat="identity",position="dodge",fill='#3333FF', width =.4 )+ # identity means that both x and y values are from the dataframe
facet_grid(.~ Agent)+
labs (title = "Number of SHR SR by Agent and by Quarter", x = "Year and Quarter", y = "Count of SHR SR")+ # to show the title
theme(axis.text.x = element_text(angle=45)) # to incline the labels at 45 degrees
}
}) |
Partager