[chronojump] If no curves found, signal graph is shown (need tests!)



commit 664da4928dccac3d159aae26672e14891f9b4ad8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Aug 20 15:00:21 2016 +0200

    If no curves found, signal graph is shown (need tests!)

 encoder/graph.R |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index e1088b5..697d1a2 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2128,7 +2128,7 @@ createPchVector <- function(ecconVector) {
 
 #-------------- end of EncoderConfiguration conversions -------------------------
 
-quitIfNoData <- function(n, curves, outputData1) {
+quitIfNoData <- function(curvesPlot, n, curves, outputData1) {
         
         debugParameters(listN(n, curves, outputData1), "quitIfNoData")
         
@@ -2136,7 +2136,10 @@ quitIfNoData <- function(n, curves, outputData1) {
        if( n== 0 || 
           ( n == 1 && (is.na(curves[1,1]) || curves[1,1] == 0 || is.na(curves[1,2]) || curves[1,2] <= 0) )  
#bad curves[1,2] on inertial returns -1
           ) {
-               plot(0,0,type="n",axes=F,xlab="",ylab="")
+               #if curvesPlot, then findCurvesNew has started a graph, don't need to start again 
+               if(! curvesPlot)
+                       plot(0,0,type="n",axes=F,xlab="",ylab="")
+
                text(x=0,y=0,translateToPrint("Sorry, no curves matched your criteria."),cex=1.5)
                dev.off()
                write("", outputData1)
@@ -2413,7 +2416,7 @@ doProcess <- function(options)
                file.create(paste(op$FeedbackFileBase,"4.txt",sep=""))
 
                n=length(curves[,1])
-               quitIfNoData(n, curves, op$OutputData1)
+               quitIfNoData(curvesPlot, n, curves, op$OutputData1)
                
                #print(curves, stderr())
        
@@ -2481,7 +2484,7 @@ doProcess <- function(options)
                        curvesPlot = TRUE
 
                n=length(curves[,1])
-               quitIfNoData(n, curves, op$OutputData1)
+               quitIfNoData(curvesPlot, n, curves, op$OutputData1)
                
                print("curves before reduceCurveBySpeed")
                print(curves)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]