@@ -594,7 +594,6 @@ app_server <- function(input, output, session) {
594594 # Hover control ############################################################
595595 output $ hover_info <- renderUI({
596596 hover <- input $ plot_hover
597- req(hover , hover $ panelvar1 )
598597 text <- xy_str(hover ) | > profileCode(" xy_str() in input$plot_hover" )
599598 req(text )
600599 div(
@@ -609,10 +608,10 @@ app_server <- function(input, output, session) {
609608
610609 # Display Time, CE, or total opioid
611610 xy_str <- function (e ) {
612- if (is.null(e )) return ()
613- if (is.null(e $ panelvar1 )) return ()
611+ if (is.null(e $ panelvar1 )) return ()
614612 outputComments(" In xy_str" )
615613 outputComments(" e$panelvar1 = " , e $ panelvar1 )
614+
616615 yaxis <- gsub(" \n " ," " , e $ panelvar1 )
617616
618617 plotResults <- plotResultsReactive()
@@ -646,8 +645,6 @@ app_server <- function(input, output, session) {
646645 x <- unlist(strsplit(yaxis ," " ))
647646 drug <- x [1 ]
648647 outputComments(" Drug identified in xy_str() is" , drug )
649- i <- which(x [1 ] == drugList )
650- if (is.null(drugs()[[drug ]])) return ()
651648 j <- which.min(abs(e $ x - drugs()[[drug ]]$ equiSpace $ Time ))
652649 x [2 ] <- substr(x [2 ],2 ,10 )
653650 x [2 ] <- substr(x [2 ],1 ,nchar(x [2 ])- 1 )
@@ -721,42 +718,17 @@ app_server <- function(input, output, session) {
721718 outputComments(" plottedDrugs" , plottedDrugs )
722719 outputComments(" plottedAll" , plottedAll )
723720
724- # Get Time
725- if (is.null(e $ x ) || is.null(e ) || length(plottedDrugs ) == 0 )
726- {
727- if (e $ coords_img $ x < 300 )
728- {
729- time <- 0
730- } else {
731- time <- plotMaximum()
732- outputComments(" time is plotMaximum:" , time )
733- }
734- } else {
735- i <- which(plottedDrugs [1 ] == drugList )
736- drug <- plottedDrugs [1 ]
737- outputComments(" Drug in imgDrugTime() is" , drug )
738- j <- which.min(abs(e $ x - drugs()[[drug ]]$ equiSpace $ Time ))
739- time <- round(drugs()[[drug ]]$ equiSpace $ Time [j ], 1 )
740- }
721+ firstDrug <- plottedDrugs [1 ]
722+ j <- which.min(abs(e $ x - drugs()[[firstDrug ]]$ equiSpace $ Time ))
723+ time <- round(drugs()[[firstDrug ]]$ equiSpace $ Time [j ], 1 )
724+
741725 if (referenceTime() == " none" )
742726 {
743727 time <- as.character(time )
744728 } else {
745729 time <- deltaToClockTime(referenceTime(), time )
746730 }
747731
748- if (is.null(e ) || length(plottedDrugs ) == 0 )
749- {
750- echoComments(" Returning because length(plottedDrugs = 0" )
751- return (
752- list (
753- drug = " propofol" ,
754- time = time ,
755- units = c(" mg" , " mcg/kg/min" )))
756- }
757-
758- # whichDrugs <- which(unlist(lapply(drugs(),function(x) {if (is.null(x$DT)) FALSE else TRUE})))
759-
760732 # Get Drug
761733 yaxis <- gsub(" \n " , " " , e $ panelvar1 )
762734 if (yaxis == " % MEAC" ) {
@@ -779,7 +751,7 @@ app_server <- function(input, output, session) {
779751 outputComments(" Exiting imgDrugTime()" )
780752 return (
781753 list (
782- drug = drug ,
754+ drug = drug ,
783755 time = time ,
784756 units = units
785757 )
0 commit comments