Commit d216d802 authored by dmattek's avatar dmattek

Changed checks for NULL data to validate-need syntax.

parent 653dfeba
......@@ -168,12 +168,6 @@ modDistPlot = function(input, output, session,
# Boxplot - display
output$outPlotBox = renderPlot({
locBut = input$butPlot
if (locBut == 0) {
cat(file = stderr(), 'boxPlot:Go button not pressed\n')
return(NULL)
}
plotBox()
......@@ -181,12 +175,6 @@ modDistPlot = function(input, output, session,
output$outPlotBoxInt = renderPlotly({
locBut = input$butPlot
if (locBut == 0) {
cat(file = stderr(), 'boxPlot:Go button not pressed\n')
return(NULL)
}
# This is required to avoid
# "Warning: Error in <Anonymous>: cannot open file 'Rplots.pdf'"
......@@ -222,14 +210,15 @@ modDistPlot = function(input, output, session,
plotBox <- function() {
cat(file = stderr(), 'plotBox\n')
locBut = input$butPlot
loc.dt = in.data()
cat(file = stderr(), "plotBox: on to plot\n\n")
if (is.null(loc.dt)) {
cat(file = stderr(), 'plotBox: dt is NULL\n')
return(NULL)
}
# Check if main data exists
# Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
loc.dt = isolate(in.data())
validate(
need(!is.null(loc.dt), "Nothing to plot. Load data first!")
)
cat(file = stderr(), 'plotBox:dt not NULL\n')
......
......@@ -130,7 +130,7 @@ tabScatterPlotUI <-
checkboxInput(ns('plotInt'),
'Interactive Plot',
value = FALSE),
actionButton(ns('butGoScatter'), 'Plot!'),
actionButton(ns('butPlot'), 'Plot!'),
uiOutput(ns("plotInt_ui")),
downPlotUI(ns('downPlotScatter'), "Download Plot")
)
......@@ -286,20 +286,18 @@ tabScatterPlot <-
plotScatter <- function() {
cat(file = stderr(), "plotScatter\n")
locBut = input$butPlot
# isolate because calculations & plotting take a while
# re-plotting done upon button press
loc.dt = isolate(data4scatterPlot())
cat("plotScatter on to plot\n\n")
if (is.null(loc.dt)) {
cat(file = stderr(), 'plotScatter: dt is NULL\n')
return(NULL)
}
# Check if main data exists
# Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
loc.dt = isolate(in.data())
validate(
need(!is.null(loc.dt), "Nothing to plot. Load data first!")
)
cat(file = stderr(), 'plotScatter:dt not NULL\n')
p.out = LOCggplotScat(
dt.arg = loc.dt,
plotlab.arg = NULL,
......@@ -314,14 +312,6 @@ tabScatterPlot <-
# Plot rendering ----
output$outPlotScatter <- renderPlot({
locBut = input$butGoScatter
if (locBut == 0) {
cat(file = stderr(), 'plotScatter: Go button not pressed\n')
return(NULL)
}
plotScatter()
})
......@@ -331,12 +321,6 @@ tabScatterPlot <-
# When running on a server. Based on:
# https://github.com/ropensci/plotly/issues/494
locBut = input$butGoScatter
if (locBut == 0) {
cat(file = stderr(), 'plotScatterInt Go button not pressed\n')
return(NULL)
}
if (names(dev.cur()) != "null device")
dev.off()
pdf(NULL)
......
......@@ -79,6 +79,7 @@ modTrajPlotUI = function(id, label = "Plot Individual Time Series") {
uiOutput(ns('uiPlotTraj')),
br(),
modTrackStatsUI(ns('dispTrackStats')),
br(),
downPlotUI(ns('downPlotTraj'), "Download Plot")
)
}
......@@ -238,26 +239,20 @@ modTrajPlot = function(input, output, session,
plotTraj <- function() {
cat(file = stderr(), 'plotTraj: in\n')
locBut = input$butPlotTraj
if (locBut == 0) {
cat(file = stderr(), 'plotTraj: Go button not pressed\n')
return(NULL)
}
# make the f-n dependent on the button click
locBut = input$butPlotTraj
# check main data exists
# Check if main data exists
# Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
loc.dt = isolate(in.data())
cat("plotTraj: on to plot\n\n")
if (is.null(loc.dt)) {
cat(file = stderr(), 'plotTraj: dt is NULL\n')
return(NULL)
}
validate(
need(!is.null(loc.dt), "Nothing to plot. Load data first!")
)
cat(file = stderr(), 'plotTraj: dt not NULL\n')
# check if stim data exists
loc.dt.stim = isolate(in.data.stim())
......@@ -267,8 +262,6 @@ modTrajPlot = function(input, output, session,
cat(file = stderr(), 'plotTraj: dt.stim not NULL\n')
}
# Future: change such that a column with colouring status is chosen by the user
# colour trajectories, if dataset contains mid.in column
# with filtering status of trajectory
......
......@@ -68,7 +68,7 @@ modTrajRibbonPlotUI = function(id, label = "Plot Individual Time Series") {
uiOutput(ns('uiPlotTraj')),
br(),
modTrackStatsUI(ns('dispTrackStats')),
br(),
downPlotUI(ns('downPlotTraj'), "Download Plot")
)
}
......@@ -232,24 +232,16 @@ modTrajRibbonPlot = function(input, output, session,
cat(file = stderr(), 'plotTrajRibbon: in\n')
locBut = input$butPlotTraj
if (locBut == 0) {
cat(file = stderr(), 'plotTrajRibbon: Go button not pressed\n')
return(NULL)
}
# check if main data exists
# Check if main data exists
# Thanks to solate all mods in the left panel are delayed
# until clicking the Plot button
loc.dt = isolate(in.data())
cat("plotTrajRibbon: on to plot\n\n")
if (is.null(loc.dt)) {
cat(file = stderr(), 'plotTrajRibbon: dt is NULL\n')
return(NULL)
}
validate(
need(!is.null(loc.dt), "Nothing to plot. Load data first!")
)
cat(file = stderr(), 'plotTrajRibbon: dt not NULL\n')
# check if stim data exists
loc.dt.stim = isolate(in.data.stim())
......
Markdown is supported
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