Bonjour,
Je développe une application shiny et j'ai quelques graphes comme output.
En exécutant mon code je trouve ce graphique qui n'est pas complet et je ne sais pas pourquoi.
Il faut mentionner aussi qu'il n'y a aucun erreur qui s'affiche pourtant que le graphique est incomplet et que la zone de sélection de l'année ne marche pas pourtant elle est supposée une "selectizeInput".
Ceci est mon output sous shiny du coté ui.R :
et voici une partie du code utilisé :
et du coté server.R
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
46
47
48
49
50
51
52
53 tabPanel("Règlements/Charge et Bonis/Malis", fluidPage( fluidRow( column(3, wellPanel(id="analyse_inputpanel", wellPanel( source("Datatriangleinput_Analyse2.R",local=TRUE)$value , #radioButtons("analyse_datatoshow", label="Data to show:", choices = list("Incremental"=1,"Cumulative"=2), selected = 1), selectInput("unitselect_analyse","Unité pour l\'affichage:",c("Unités"=1,"Centains"=100,"Milliers"=1000,"Millions"=1000000,"Billions"=1000000000),selected=1), # Select year here selectizeInput("Year", label = "Année", choices = unique(df$origin), multiple = F, options = list(maxItems = 1, placeholder = 'Choisir une année'), selected = "2007"), hr(), fluidRow(actionButton("Infoanalyse1","Aide",icon = icon("info")),actionButton("Resetanalyseinputs","Réinitialiser les entrées",icon = icon("refresh"))) ) ) ), column(9, tabBox(width=NULL, tabPanel("Triangle", h5("Affichage des données selectionnées") , DT::dataTableOutput("Data777")%>% withSpinner() ), tabPanel("Graphiques", tabBox(title="", id="analysegraphstab",width=NULL, tabPanel("Boni/Mali", box(width=NULL,title="",status="primary",solidHeader=FALSE, plotlyOutput("barPlot001") %>% withSpinner()) ), tabPanel("Règlements/Charge", box(width=NULL,title="",status="primary",solidHeader=FALSE, plotlyOutput("barPlot002") %>% withSpinner()) ) ) ) ),style='width: 800px; height: 800px'# end of tabBox ) ) # end fluidRow ) # end fluidPage )# end of tabPanel Contact information
Je serai très reconnaissante pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 output$barPlot001 <- renderPlotly({ datasetshow <- dataset_analyseInput2() x<-datasetshow #`Boni/Mali` #df<-melt(t(`Boni/Mali`)) library(reshape) library(ggplot2) df<-melt(t(x)) df_trend <- df[df$origin == input$Year, ] #df_trend <- df[df$origin == "2007", ] df_trend d<-df_trend[,ncol(df_trend)] d<-as.data.frame(d) print(d) dev.period<-df_trend$dev print(d) bp<-ggplot(d, aes(dev.period, d)) + geom_bar(stat = "identity", aes(fill = dev.period))+ xlab("Developement Period") + ylab("Boni/Mali")+ theme(plot.title = element_text(hjust = 0.5,size = 10))+ theme(plot.title = element_text(hjust = 0.5,size = 10))+ ggtitle("Barplot of Boni/Mali through developement periods for the selected year") bp + theme( plot.title = element_text(color="black", size=12, face="bold"), axis.title.x = element_text(color="black", size=10), axis.title.y = element_text(color="black", size=10), axis.line = element_line(colour = "lightgrey", size = 1, linetype = "solid"), panel.background = element_rect(colour = "lightgrey", size = 1) ) }) output$barPlot002 <- renderPlotly({ datasetshow <- dataset_analyseInput2() x<-datasetshow #BM<-read.csv("bonimali.csv") #BM<-BM[,-1] #BM #BM<-BM[,-2] #BM #`Boni/Mali` #df<-melt(t(`Boni/Mali`)) library(reshape) library(ggplot2) df<-melt(t(x)) #df_trend <- df[df$origin == "2007", ] df_trend <- df[df$origin == input$Year, ] df_trend d<-df_trend[,ncol(df_trend)] d<-as.data.frame(d) dev.period<-df_trend$dev bp<-ggplot(d, aes(dev.period, d)) + geom_bar(stat = "identity", aes(fill = dev.period))+ xlab("Developement Period") + ylab("Paid/Incurred ratio")+ theme(plot.title = element_text(hjust = 0.5,size = 10))+ theme(plot.title = element_text(hjust = 0.5,size = 10))+ ggtitle("Barplot of Paid/ Incurred ratio through developement periods for the selected year") bp + theme( plot.title = element_text(color="black", size=12, face="bold"), axis.title.x = element_text(color="black", size=10), axis.title.y = element_text(color="black", size=10), axis.line = element_line(colour = "lightgrey", size = 1, linetype = "solid"), panel.background = element_rect(colour = "lightgrey", size = 1) ) })
Partager