I am trying to place the plots i have made using plot_ly in R in my dashboard. I am using the fluidRow() structure, and have great trouble trying to make my plots fill out the screen. As i understand the screen is divided into 12 parts, so i should with the following code have three rows, the first one containing two plots of equal size: 6, the second containing 3 plots of equal size: 4, and a third row containing a plot of size 8,and an ui output of size 4. Here is the code for my whole ui:
ui <- fluidPage(
titlePanel("Dashboard"),
mainPanel(
selectInput("select", label = h3("Quality Indicator"),
choices = list(
"discharge_any_anticoagulant" = "af_p_dis_anticoag",
"discharge_any_antiplatelet" = "isp_dis_antiplat",
"door_to_groin" = "door_to_groin",
"door_to_needle" = "door_to_needle",
"dysphagia_screening_type" = "p_dys_screen",
"thrombolysis" = "rec_total_is",
"hospitalized_in" = "sp_hosp_stroke_unit_ICU"
),
selected = "af_p_dis_anticoag"),
fluidRow(
column(6,plotlyOutput("QIplot", width = "100%", height = "100%")),
column(6,plotlyOutput("barplotStroke", width = "100%", height = "100%"))
),
fluidRow(
column(4,plotlyOutput("barplotGender",width = "100%", height = "100%")),
column(4,plotlyOutput("barplotImage",width = "100%", height = "100%")),
column(4,plotlyOutput("barplotPrenotification",width = "100%", height = "100%"))
),
fluidRow(
column(8,plotlyOutput("awardCountPlot",width = "100%", height = "100%")),
column(4,uiOutput("award_info",width = "100%", height = "100%"))
),
)
)
As shown in the picture below, it doesn't seem to work:
This is the code for one of the plots:
plot_ly(orientation = 'h') %>%
add_trace(data = data_list$data_all,
y = ~subGroupVal, x = ~Value,
type = 'bar',
name = 'Country Average 2022',
marker = list(color = 'lightgray')) %>%
add_trace(data = data_list$data_2022,
y = ~subGroupVal,
x = ~Value,
type = 'bar',
name = 'General 2022',
marker = list(color = 'lightblue')) %>%
add_trace(data = data_list$data_2021,
y = ~subGroupVal,
x = ~Value,
type = 'bar',
name = 'General 2021',
marker = list(color = 'orange')) %>%
layout(title = paste(title_mapping[[input$select]], "Stroke Types", sep = " - "),
yaxis = list(title = FALSE),
xaxis = list(title = FALSE),
showlegend = TRUE,
hovermode = "false",
barmode = 'group',
autosize = TRUE,
width = "100%")```
I hope one of you can help.