jofaichow commited on
Commit
f7ef7d7
1 Parent(s): ee096a2

removed the switch button for payout - the chart output on HF is unstable

Browse files
Files changed (1) hide show
  1. app/app.R +15 -9
app/app.R CHANGED
@@ -325,12 +325,12 @@ ui <- shinydashboardPlus::dashboardPage(
325
  ),
326
 
327
  tabPanel("Individual Models",
328
- br(),
329
- materialSwitch(inputId = "switch_scale_payout",
330
- label = "Fixed Y-axis Scale",
331
- value = TRUE,
332
- status = "primary",
333
- ),
334
  br(),
335
  h3(strong(textOutput(outputId = "text_payout_ind_models"))),
336
  br(),
@@ -670,6 +670,9 @@ server <- function(input, output) {
670
  # Data
671
  d_filter <- react_d_filter()
672
 
 
 
 
673
  # ggplot
674
  p <- ggplot(d_filter,
675
  aes(x = date_resolved, y = payout, fill = payout,
@@ -713,6 +716,9 @@ server <- function(input, output) {
713
  # Data
714
  d_filter <- react_d_filter()
715
 
 
 
 
716
  # Get the number of unique models
717
  n_model <- length(unique(d_filter$model))
718
 
@@ -746,12 +752,12 @@ server <- function(input, output) {
746
  ylab("Realised / Pending Payout (NMR)")
747
 
748
  # Facet setting
749
- if (input$switch_scale_payout) {
750
  p <- p + facet_wrap(. ~ model, ncol = 5, scales = "fixed")
751
  } else {
752
- p <- p + facet_wrap(. ~ model, ncol = 5, scales = "free_y")
753
  }
754
-
755
  # Dynamic height adjustment
756
  height <- 600 # default
757
  if (n_model > 10) height = 800
 
325
  ),
326
 
327
  tabPanel("Individual Models",
328
+ # br(),
329
+ # materialSwitch(inputId = "switch_scale_payout",
330
+ # label = "Fixed Scale?",
331
+ # value = TRUE,
332
+ # status = "primary",
333
+ # ),
334
  br(),
335
  h3(strong(textOutput(outputId = "text_payout_ind_models"))),
336
  br(),
 
670
  # Data
671
  d_filter <- react_d_filter()
672
 
673
+ # Filter
674
+ d_filter <- d_filter[stake > 0]
675
+
676
  # ggplot
677
  p <- ggplot(d_filter,
678
  aes(x = date_resolved, y = payout, fill = payout,
 
716
  # Data
717
  d_filter <- react_d_filter()
718
 
719
+ # Filter
720
+ d_filter <- d_filter[stake > 0]
721
+
722
  # Get the number of unique models
723
  n_model <- length(unique(d_filter$model))
724
 
 
752
  ylab("Realised / Pending Payout (NMR)")
753
 
754
  # Facet setting
755
+ if ((n_model %% 5) == 0) {
756
  p <- p + facet_wrap(. ~ model, ncol = 5, scales = "fixed")
757
  } else {
758
+ p <- p + facet_wrap(. ~ model, scales = "fixed")
759
  }
760
+
761
  # Dynamic height adjustment
762
  height <- 600 # default
763
  if (n_model > 10) height = 800