Commit fbdd2ba7 authored by dmattek's avatar dmattek
Browse files

Option to set X/Y-axis bunds

parent 1fc75946
...@@ -28,21 +28,33 @@ modTrajPlotUI = function(id, label = "Plot Individual Time Series") { ...@@ -28,21 +28,33 @@ modTrajPlotUI = function(id, label = "Plot Individual Time Series") {
), ),
column( column(
2, 2,
checkboxGroupInput(ns('chBPlotTrajStat'), 'Stats:', list('Mean' = 'mean', '95% conf. interv.' = 'CI', 'Std. error' = 'SE')) checkboxGroupInput(ns('chBPlotTrajStat'), 'Stats:', list('Mean' = 'mean',
'95% conf. interv.' = 'CI',
'Std. error' = 'SE'))
), ),
column( column(
3, 3,
sliderInput(ns('sliPlotTrajSkip'), 'Plot every n-th point:', min = 1, max = 10, value = 1, step = 1), sliderInput(ns('sliPlotTrajSkip'), 'Plot every n-th point:',
checkboxInput(ns('chBsetColBounds'), 'Set bounds for y-axis', FALSE), min = 1, max = 10, value = 1, step = 1),
checkboxInput(ns('chBsetXbounds'), 'Set bounds for x-axis', FALSE),
fluidRow( fluidRow(
column(6, column(6,
uiOutput(ns('uiSetColBoundsLow')) uiOutput(ns('uiSetXboundsLow'))
), ),
column(6, column(6,
uiOutput(ns('uiSetColBoundsHigh')) uiOutput(ns('uiSetXboundsHigh'))
) )),
)
checkboxInput(ns('chBsetYbounds'), 'Set bounds for y-axis', FALSE),
fluidRow(
column(6,
uiOutput(ns('uiSetYboundsLow'))
),
column(6,
uiOutput(ns('uiSetYboundsHigh'))
))
), ),
column( column(
...@@ -97,60 +109,76 @@ modTrajPlot = function(input, output, session, ...@@ -97,60 +109,76 @@ modTrajPlot = function(input, output, session,
) )
}) })
# UI for bounding the x-axis ====
# UI for trimming y-axis output$uiSetXboundsLow = renderUI({
output$uiSetColBoundsLow = renderUI({
ns <- session$ns ns <- session$ns
if(input$chBsetColBounds) { if(input$chBsetXbounds) {
loc.dt = in.data() loc.dt = in.data()
numericInput( numericInput(
ns('inSetColBoundsLow'), ns('inSetXboundsLow'),
label = 'Lower', label = 'Lower',
step = 0.1, step = 0.1,
value = floor(min(loc.dt[['y']], na.rm = T)) value = floor(min(loc.dt[[COLRT]], na.rm = T))
) )
} }
}) })
output$uiSetColBoundsHigh = renderUI({ output$uiSetXboundsHigh = renderUI({
ns <- session$ns ns <- session$ns
if(input$chBsetColBounds) { if(input$chBsetXbounds) {
loc.dt = in.data() loc.dt = in.data()
numericInput( numericInput(
ns('inSetColBoundsHigh'), ns('inSetXboundsHigh'),
label = 'Upper', label = 'Upper',
step = 0.1, step = 0.1,
value = ceil(max(loc.dt[['y']], na.rm = T)) value = ceil(max(loc.dt[[COLRT]], na.rm = T))
) )
} }
}) })
output$uiSlYTrim = renderUI({
cat(file = stderr(), 'UI uiSlYTrim\n')
loc.dt = in.data() # UI for bounding the y-axis ====
output$uiSetYboundsLow = renderUI({
ns <- session$ns
locYmin = signif(min(loc.dt$y, na.rm = T), 4) if(input$chBsetYbounds) {
locYmax = signif(max(loc.dt$y, na.rm = T), 4)
sliderInput( loc.dt = in.data()
ns('slYTrim'),
label = 'Trim y-axis',
min = locYmin,
max = locYmax,
value = c(locYmin, locYmax)
)
numericInput(
ns('inSetYboundsLow'),
label = 'Lower',
step = 0.1,
value = floor(min(loc.dt[[COLY]], na.rm = T))
)
}
}) })
output$uiSetYboundsHigh = renderUI({
ns <- session$ns
if(input$chBsetYbounds) {
loc.dt = in.data()
numericInput(
ns('inSetYboundsHigh'),
label = 'Upper',
step = 0.1,
value = ceil(max(loc.dt[[COLY]], na.rm = T))
)
}
})
# Plotting ====
callModule(modTrackStats, 'dispTrackStats', callModule(modTrackStats, 'dispTrackStats',
in.data = in.data) in.data = in.data)
...@@ -187,6 +215,7 @@ modTrajPlot = function(input, output, session, ...@@ -187,6 +215,7 @@ modTrajPlot = function(input, output, session,
# Trajectory plot - download pdf # Trajectory plot - download pdf
callModule(downPlot, "downPlotTraj", in.fname, plotTraj, TRUE) callModule(downPlot, "downPlotTraj", in.fname, plotTraj, TRUE)
plotTraj <- function() { plotTraj <- function() {
cat(file = stderr(), 'plotTraj: in\n') cat(file = stderr(), 'plotTraj: in\n')
locBut = input$butPlotTraj locBut = input$butPlotTraj
...@@ -267,6 +296,16 @@ modTrajPlot = function(input, output, session, ...@@ -267,6 +296,16 @@ modTrajPlot = function(input, output, session,
} }
loc.ylim.arg = NULL
if(input$chBsetYbounds) {
loc.ylim.arg = c(input$inSetYboundsLow, input$inSetYboundsHigh)
}
loc.xlim.arg = NULL
if(input$chBsetXbounds) {
loc.xlim.arg = c(input$inSetXboundsLow, input$inSetXboundsHigh)
}
p.out = LOCplotTraj( p.out = LOCplotTraj(
dt.arg = loc.dt, dt.arg = loc.dt,
x.arg = 'realtime', x.arg = 'realtime',
...@@ -285,7 +324,8 @@ modTrajPlot = function(input, output, session, ...@@ -285,7 +324,8 @@ modTrajPlot = function(input, output, session,
aux.label2 = if (locPos) 'pos.y' else NULL, aux.label2 = if (locPos) 'pos.y' else NULL,
aux.label3 = if (locObjNum) 'obj.num' else NULL, aux.label3 = if (locObjNum) 'obj.num' else NULL,
stat.arg = input$chBPlotTrajStat, stat.arg = input$chBPlotTrajStat,
ylim.arg = c(input$inSetColBoundsLow, input$inSetColBoundsHigh) ylim.arg = loc.ylim.arg,
xlim.arg = loc.xlim.arg
) )
return(p.out) return(p.out)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment