[HepData-svn] r1635 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Jun 28 12:24:41 BST 2013


Author: whalley
Date: Fri Jun 28 12:24:41 2013
New Revision: 1635

Log:
fix problems with -ve logs in Combined plots

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java	Tue Jun 25 09:54:44 2013	(r1634)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlot.java	Fri Jun 28 12:24:41 2013	(r1635)
@@ -558,6 +558,7 @@
         double xlow = 1000000.0;
         double xhigh = -1000000.0;
         double ylow = 1000000.0;
+        double ylowpos = 1000000.0;
         double yhigh = -1000000.0;
         for (int n=1; n<=number; n++){
             XYIntervalSeries series = (XYIntervalSeries) seriesMap.get(numberRunStart+n);
@@ -566,6 +567,7 @@
                 if(series.getXLowValue(nn) < xlow){ xlow = series.getXLowValue(nn);};     
                 if(series.getXHighValue(nn) > xhigh){ xhigh = series.getXHighValue(nn);};     
                 if(series.getYLowValue(nn) < ylow){ ylow = series.getYLowValue(nn);};     
+                if(series.getYLowValue(nn) > 0.0 && series.getYLowValue(nn) < ylowpos){ ylowpos = series.getYLowValue(nn);};     
                 if(series.getYHighValue(nn) > yhigh){ yhigh = series.getYHighValue(nn);};     
             }
             seriesMap.remove(numberRunStart+n);
@@ -583,6 +585,7 @@
         if(OptionHasDouble("xmin") != null){xlow  = OptionHasDouble("xmin");}
         if(OptionHasDouble("ymax") != null){yhigh = OptionHasDouble("ymax");}
         if(OptionHasDouble("ymin") != null){ylow  = OptionHasDouble("ymin");}
+        if(OptionHasDouble("ymin") != null){ylowpos  = OptionHasDouble("ymin");}
  
         IntervalXYDataset data1 = collection;
  
@@ -590,16 +593,17 @@
         renderer1.setCapLength(3); 
         final Range rangex = new Range(xlow,xhigh);
         final Range rangey = new Range(ylow,yhigh);
+        final Range rangeypos = new Range(ylowpos,yhigh);
 
         NumberAxis rangeAxisX = null;
         if(_xscale.equals("lin")){
-	        rangeAxisX = new NumberAxis();
+	    rangeAxisX = new NumberAxis();
             rangeAxisX.setRange(rangex);
-	    } else{
+	} else{
             LogarithmicAxis logaxistemp = new LogarithmicAxis("header");
-	        rangeAxisX = logaxistemp;
+	    rangeAxisX = logaxistemp;
             if(OptionHasDouble("xmin") != null && OptionHasDouble("xmax") != null) {rangeAxisX.setRange(rangex);}
-	    }
+	}
         try {
             String xlabel = (String) xLabelMap.get(numberRunStart+1);
             rangeAxisX.setLabel(xlabel);
@@ -612,12 +616,13 @@
         if(_yscale.equals("lin")) {
             rangeAxisY = new NumberAxis();
             rangeAxisY.setRange(rangey);
-	    } else{
+	} else{
             LogarithmicAxis logaxistemp = new LogarithmicAxis(_yaxis.getHeader());
-	        rangeAxisY = logaxistemp;
-            if(OptionHasDouble("ymin") != null && OptionHasDouble("ymax") != null) {rangeAxisY.setRange(rangey);}
-            logaxistemp.setAllowNegativesFlag(true);
-       }	
+	    rangeAxisY = logaxistemp;
+            rangeAxisY.setRange(rangeypos);
+            //if(OptionHasDouble("ymin") != null && OptionHasDouble("ymax") != null) {rangeAxisY.setRange(rangeypos);}
+            //logaxistemp.setAllowNegativesFlag(true);
+        }	
         try{
             String ylabel = (String) yLabelMap.get(numberRunStart+1);
             rangeAxisY.setLabel(ylabel);

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java	Tue Jun 25 09:54:44 2013	(r1634)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java	Fri Jun 28 12:24:41 2013	(r1635)
@@ -771,6 +771,7 @@
         double xlow = 1000000.0;
         double xhigh = -1000000.0;
         double ylow = 1000000.0;
+        double ylowpos = 1000000.0;
         double yhigh = -1000000.0;
 // first run through the series to find max and min values        
         for (int n=1; n<=number; n++){
@@ -780,6 +781,7 @@
                 if(series.getXLowValue(nn) < xlow){ xlow = series.getXLowValue(nn);};     
                 if(series.getXHighValue(nn) > xhigh){ xhigh = series.getXHighValue(nn);};     
                 if(series.getYLowValue(nn) < ylow){ ylow = series.getYLowValue(nn);};     
+                if(series.getYLowValue(nn) > 0.0 && series.getYLowValue(nn) < ylowpos){ ylowpos = series.getYLowValue(nn);};     
                 if(series.getYHighValue(nn) > yhigh){ yhigh = series.getYHighValue(nn);};     
             }
         }
@@ -804,7 +806,12 @@
         if(xmax != null) { xhigh = Double.valueOf(xmax); }  else { xmax=(Double.toString(xhigh)); }     
         if(xmin != null) { xlow = Double.valueOf(xmin); }  else { xmin=Double.toString(xlow); }       
         if(ymax != null) { yhigh = Double.valueOf(ymax); }  else { ymax=Double.toString(yhigh); }       
-        if(ymin != null) { ylow = Double.valueOf(ymin); }   else { ymin=Double.toString(ylow); }        
+        if(_yscale.equals("lin")){ 
+            if(ymin != null) { ylow = Double.valueOf(ymin); }   else { ymin=Double.toString(ylow); }        
+        }
+        else{
+            if(ymin != null) { ylowpos = Double.valueOf(ymin); }   else { ymin=Double.toString(ylowpos); }        
+        }
 
 // then run through again to do things....
         for (int n=1; n<=number; n++){
@@ -913,6 +920,7 @@
 
         final Range rangex = new Range(xlow,xhigh);
         final Range rangey = new Range(ylow,yhigh);
+        final Range rangeypos = new Range(ylowpos,yhigh);
 
         NumberAxis rangeAxisX = null;
         if(_xscale.equals("lin")){
@@ -935,12 +943,13 @@
         if(_yscale.equals("lin")) {
             rangeAxisY = new NumberAxis();
             rangeAxisY.setRange(rangey);
-	    } else{
+	} else{
             LogarithmicAxis logaxistemp = new LogarithmicAxis(_yaxis.getHeader());
-	        rangeAxisY = logaxistemp;
-            if(ymin != null && ymax != null) {rangeAxisY.setRange(rangey);}
-            logaxistemp.setAllowNegativesFlag(true);
-       }	
+	    rangeAxisY = logaxistemp;
+            rangeAxisY.setRange(rangeypos);
+            //if(ymin != null && ymax != null) {rangeAxisY.setRange(rangey);}
+            //logaxistemp.setAllowNegativesFlag(true);
+        }	
         try{
             String ylabel = (String) yLabelMap.get(numberRunStart+1);
             rangeAxisY.setLabel(ylabel);
@@ -1081,7 +1090,6 @@
     @OnEvent(value="selected",component="simpleButton")
     void onSimpleButton()
     {
-        System.out.println("Back to simple plot");
         combinedplot.setSavedList(getSavedList());
         combinedplot.setXId("1");
         combinedplot.setXscale(xscale);
@@ -1112,7 +1120,6 @@
         combinedplot.setOptionstring9(optionstring9);
         combinedplot.setOptionstring10(optionstring10);
         nextPage=CombinedPlot.class;
-        System.out.println("nextPage " + nextPage.toString());
     }
     @OnEvent(value="selected",component="resetButton1")
     void onResetButton1()

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java	Tue Jun 25 09:54:44 2013	(r1634)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/PlotCombinedImage.java	Fri Jun 28 12:24:41 2013	(r1635)
@@ -283,6 +283,7 @@
         double xlow = 1000000.0;
         double xhigh = -1000000.0;
         double ylow = 1000000.0;
+        double ylowpos = 1000000.0;
         double yhigh = -1000000.0;
         String titlestring = "";
         String xlabel = "";
@@ -295,6 +296,7 @@
                 if(series.getXLowValue(nn) < xlow){ xlow = series.getXLowValue(nn);};     
                 if(series.getXHighValue(nn) > xhigh){ xhigh = series.getXHighValue(nn);};     
                 if(series.getYLowValue(nn) < ylow){ ylow = series.getYLowValue(nn);};     
+                if(series.getYLowValue(nn) > 0.0 && series.getYLowValue(nn) < ylowpos){ ylowpos = series.getYLowValue(nn);};     
                 if(series.getYHighValue(nn) > yhigh){ yhigh = series.getYHighValue(nn);};     
             }
 
@@ -325,7 +327,11 @@
         if(_xmax != null) { xhigh = Double.valueOf(_xmax); }  else { _xmax=(Double.toString(xhigh)); }     
         if(_xmin != null) { xlow = Double.valueOf(_xmin); }  else { _xmin=Double.toString(xlow); }       
         if(_ymax != null) { yhigh = Double.valueOf(_ymax); }  else { _ymax=Double.toString(yhigh); }       
-        if(_ymin != null) { ylow = Double.valueOf(_ymin); }   else { _ymin=Double.toString(ylow); }        
+        if(_yscale.equals("lin")){ 
+            if(_ymin != null) { ylow = Double.valueOf(_ymin); }   else { _ymin=Double.toString(ylow); }        
+        } else { 
+            if(_ymin != null) { ylowpos = Double.valueOf(_ymin); }   else { _ymin=Double.toString(ylowpos); }        
+        }
 
         final XYErrorRenderer renderer1 = new XYErrorRenderer();
        
@@ -418,6 +424,8 @@
        
        final Range rangex = new Range(xlow,xhigh);
        final Range rangey = new Range(ylow,yhigh);
+       final Range rangeypos = new Range(ylowpos,yhigh);
+
        NumberAxis rangeAxisX = null;
        if(_xscale.equals("lin")){
 	       rangeAxisX = new NumberAxis();
@@ -434,12 +442,13 @@
         if(_yscale.equals("lin")) {
             rangeAxisY = new NumberAxis();
             rangeAxisY.setRange(rangey);
-	    } else{
+        } else{
 //            LogarithmicAxis logaxistemp = new LogarithmicAxis(_yaxis.getHeader());
             LogarithmicAxis logaxistemp = new LogarithmicAxis("header");
-	        rangeAxisY = logaxistemp;
-            if(_ymin != null && _ymax != null) {rangeAxisY.setRange(rangey);}
-       }	
+	    rangeAxisY = logaxistemp;
+            rangeAxisY.setRange(rangeypos);
+            //if(_ymin != null && _ymax != null) {rangeAxisY.setRange(rangey);}
+        }	
         rangeAxisY.setLabel(ylabel);
  
 


More information about the HepData-svn mailing list