Spaces:
Running
Running
tweaked facet_wrap
Browse files
app/app.R
CHANGED
@@ -754,23 +754,28 @@ server <- function(input, output) {
|
|
754 |
ylab("Realised / Pending Payout (NMR)")
|
755 |
|
756 |
# Facet setting
|
757 |
-
if ((n_model %%
|
|
|
|
|
758 |
p <- p + facet_wrap(. ~ model, ncol = 5, scales = "fixed")
|
759 |
} else {
|
760 |
-
p <- p + facet_wrap(. ~ model, scales = "fixed")
|
761 |
}
|
762 |
-
|
763 |
# Dynamic height adjustment
|
764 |
-
height <- 600 # default
|
765 |
-
if (n_model
|
766 |
-
if (n_model
|
767 |
-
if (n_model
|
768 |
-
if (n_model
|
769 |
-
if (n_model
|
770 |
-
if (n_model
|
771 |
-
if (n_model
|
772 |
-
if (n_model
|
773 |
-
if (n_model
|
|
|
|
|
|
|
774 |
|
775 |
# Generate plotly
|
776 |
ggplotly(p, height = height, tooltip = "text")
|
|
|
754 |
ylab("Realised / Pending Payout (NMR)")
|
755 |
|
756 |
# Facet setting
|
757 |
+
if ((n_model %% 4) == 0) {
|
758 |
+
p <- p + facet_wrap(. ~ model, ncol = 4, scales = "fixed")
|
759 |
+
} else if ((n_model %% 5) == 0) {
|
760 |
p <- p + facet_wrap(. ~ model, ncol = 5, scales = "fixed")
|
761 |
} else {
|
762 |
+
p <- p + facet_wrap(. ~ model, ncol = 6, scales = "fixed")
|
763 |
}
|
764 |
+
|
765 |
# Dynamic height adjustment
|
766 |
+
height <- 600 # default minimum height
|
767 |
+
if (n_model >= 10) height = 800
|
768 |
+
if (n_model >= 15) height = 1000
|
769 |
+
if (n_model >= 20) height = 1200
|
770 |
+
if (n_model >= 25) height = 1400
|
771 |
+
if (n_model >= 30) height = 1600
|
772 |
+
if (n_model >= 35) height = 1800
|
773 |
+
if (n_model >= 40) height = 2000
|
774 |
+
if (n_model >= 45) height = 2200
|
775 |
+
if (n_model >= 50) height = 2400
|
776 |
+
if (n_model >= 55) height = 2600
|
777 |
+
if (n_model >= 60) height = 2800
|
778 |
+
if (n_model >= 65) height = 3000
|
779 |
|
780 |
# Generate plotly
|
781 |
ggplotly(p, height = height, tooltip = "text")
|