Spaces:
Running
Running
Update app.R
Browse files
app.R
CHANGED
|
@@ -821,32 +821,34 @@ server <- function(input, output, session) {
|
|
| 821 |
DT::formatStyle(columns = names(summary_stats), fontSize = '12px')
|
| 822 |
})
|
| 823 |
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
} else "",
|
| 842 |
-
sep = "\n"
|
| 843 |
-
)
|
| 844 |
-
|
| 845 |
-
return(info_text)
|
| 846 |
-
} else {
|
| 847 |
-
return("No pitch selected")
|
| 848 |
}
|
| 849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 850 |
|
| 851 |
# Update pitch type
|
| 852 |
observeEvent(input$update_pitch, {
|
|
|
|
| 821 |
DT::formatStyle(columns = names(summary_stats), fontSize = '12px')
|
| 822 |
})
|
| 823 |
|
| 824 |
+
output$selected_pitch_info <- renderText({
|
| 825 |
+
pitch_info <- selected_pitch()
|
| 826 |
+
if (!is.null(pitch_info)) {
|
| 827 |
+
pitch_data <- pitch_info$data
|
| 828 |
+
|
| 829 |
+
# Build info text with only available fields
|
| 830 |
+
info_lines <- c(
|
| 831 |
+
paste("Pitcher:", pitch_info$pitcher),
|
| 832 |
+
paste("Current Type:", pitch_data$TaggedPitchType),
|
| 833 |
+
paste("Velocity:", round(pitch_data$RelSpeed, 1), "mph"),
|
| 834 |
+
paste("Horizontal Break:", round(pitch_data$HorzBreak, 1), "inches"),
|
| 835 |
+
paste("Induced Vertical Break:", round(pitch_data$InducedVertBreak, 1), "inches")
|
| 836 |
+
)
|
| 837 |
+
|
| 838 |
+
# Add optional fields only if they exist and have values
|
| 839 |
+
if ("SpinRate" %in% names(pitch_data) && !is.na(pitch_data$SpinRate)) {
|
| 840 |
+
info_lines <- c(info_lines, paste("Spin Rate:", round(pitch_data$SpinRate, 0), "rpm"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 841 |
}
|
| 842 |
+
|
| 843 |
+
if ("Date" %in% names(pitch_data) && !is.na(pitch_data$Date)) {
|
| 844 |
+
info_lines <- c(info_lines, paste("Date:", pitch_data$Date))
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
return(paste(info_lines, collapse = "\n"))
|
| 848 |
+
} else {
|
| 849 |
+
return("No pitch selected")
|
| 850 |
+
}
|
| 851 |
+
})
|
| 852 |
|
| 853 |
# Update pitch type
|
| 854 |
observeEvent(input$update_pitch, {
|