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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Mar 19 15:36:42 GMT 2014


Author: watt
Date: Wed Mar 19 15:36:41 2014
New Revision: 1766

Log:
Choose appropriate log/lin scale for y axis in CombinedPlotAdvanced

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

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 Mar 18 20:46:29 2014	(r1765)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/CombinedPlotAdvanced.java	Wed Mar 19 15:36:41 2014	(r1766)
@@ -135,7 +135,7 @@
           this.setYmax(null);
           this.setXscale("lin");
           if(yscale == null) {
-              this.setYscale("lin");
+	      this.setYscale("lin");
           } else {
               this.setYscale(yscale);
           }
@@ -1094,7 +1094,7 @@
     {
         this.setXId("1");
         this.setXscale(xscale);
-        this.setYscale(yscale);
+	this.setYscale(yscale);
         this.setXsize(xsize);
         this.setYsize(ysize);
         this.setXmax(xmax);
@@ -1153,7 +1153,19 @@
         this.setYmax(null);
         this.setYmin(null);
         this.setXscale("lin");
-        this.setYscale("lin");
+	//this.setYscale("lin");
+	Double ymin = 0.0, ymax = 0.0;
+	for (YAxis ya : getYAxes()){
+	    if ((ymin == 0.0 && ymax == 0.0) || ymin > ya.getMinValue()) {
+		ymin = ya.getMinValue();
+	    }
+	    if ((ymin == 0.0 && ymax == 0.0) || ymax < ya.getMaxValue()) {
+		ymax = ya.getMaxValue();
+	    }
+	}
+	Double yratio = ymax/ymin;
+	if (ymin > 0.0 && yratio > 100.0) { this.setYscale("log"); }
+	else { this.setYscale("lin"); }
         this.setXsize("400");
         this.setYsize("400");
         this.setXkey("0.7");
@@ -1179,7 +1191,19 @@
         this.setYmax(null);
         this.setYmin(null);
         this.setXscale("lin");
-        this.setYscale("lin");
+	//this.setYscale("lin");
+	Double ymin = 0.0, ymax = 0.0;
+	for (YAxis ya : getYAxes()){
+	    if ((ymin == 0.0 && ymax == 0.0) || ymin > ya.getMinValue()) {
+		ymin = ya.getMinValue();
+	    }
+	    if ((ymin == 0.0 && ymax == 0.0) || ymax < ya.getMaxValue()) {
+		ymax = ya.getMaxValue();
+	    }
+	}
+	Double yratio = ymax/ymin;
+	if (ymin > 0.0 && yratio > 100.0) { this.setYscale("log"); }
+	else { this.setYscale("lin"); }
         this.setXkey("0.7");
         this.setYkey("0.9");
         this.setXtext("0.7");

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/SavePlot.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/SavePlot.java	Tue Mar 18 20:46:29 2014	(r1765)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/SavePlot.java	Wed Mar 19 15:36:41 2014	(r1766)
@@ -357,7 +357,21 @@
         //if(combinedplotadvanced.getYmax() == null){ combinedplotadvanced.setYmax(null); }
         //if(combinedplotadvanced.getYmin() == null){ combinedplotadvanced.setYmin(null); }
         if(combinedplotadvanced.getXscale() == null){ combinedplotadvanced.setXscale(xscale); }
-        if(combinedplotadvanced.getYscale() == null){ combinedplotadvanced.setYscale(yscale); }
+        //if(combinedplotadvanced.getYscale() == null){ combinedplotadvanced.setYscale(yscale); }
+	if(combinedplotadvanced.getYscale() == null){
+	    Double ymin = 0.0, ymax = 0.0;
+	    for (YAxis ya : combinedplotadvanced.getYAxes()){
+		if ((ymin == 0.0 && ymax == 0.0) || ymin > ya.getMinValue()) {
+		    ymin = ya.getMinValue();
+		}
+		if ((ymin == 0.0 && ymax == 0.0) || ymax < ya.getMaxValue()) {
+		    ymax = ya.getMaxValue();
+		}
+	    }
+	    Double yratio = ymax/ymin;
+	    if (ymin > 0.0 && yratio > 100.0) { combinedplotadvanced.setYscale("log"); }
+	    else { combinedplotadvanced.setYscale("lin"); }
+	}
         if(combinedplotadvanced.getPlotType() == null){ combinedplotadvanced.setPlotType(null); }
         if(combinedplotadvanced.getXkey() == null){ combinedplotadvanced.setXkey(null); }
         if(combinedplotadvanced.getYkey() == null){ combinedplotadvanced.setYkey(null); }


More information about the HepData-svn mailing list