|
[HepData-svn] r1725 - in trunk/hepdata-webapp/src/main/java/cedar/hepdata: formats webapp/componentsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Dec 11 16:36:28 GMT 2013
Author: whalley Date: Wed Dec 11 16:36:28 2013 New Revision: 1725 Log: adding >1 xaxis plotting, no plotting if non-numeric, and reemoving the report to us message in the other formats Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MatplotlibFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YodaFormatter.java trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/AidaFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -142,7 +142,7 @@ } } } catch (NullPointerException npe) { - s.append("<!-- Can't render this plot, due to missing/incompatible information: please report this problem! -->\n"); + s.append("<!-- Can't render this plot, due to missing/incompatible information -->\n"); s.append(" </dataPoint>\n"); s.append(" </dataPointSet>\n"); } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MatplotlibFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MatplotlibFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/MatplotlibFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -119,7 +119,7 @@ out = s.toString(); } } catch (NullPointerException npe) { - out = "# Can't render this plot, due to missing/incompatible information: please report this problem!\n\n"; + out = "# Can't render this plot, due to missing/incompatible information\n\n"; } return out; } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PlainFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -196,10 +196,12 @@ // Column key + s.append("xdesc\t"); s.append("x\t"); s.append("xlow\t"); s.append("xhigh\t"); for (int ix=1; ix<x.getDataset().getXAxes().size(); ix++){ + s.append("x" + Integer.toString(ix+1) + "desc\t"); s.append("x" + Integer.toString(ix+1) + "\t"); s.append("x" + Integer.toString(ix+1) + "low\t"); s.append("x" + Integer.toString(ix+1) + "high\t"); @@ -223,19 +225,23 @@ Double xlow = b.getLowValue(); Double xhigh = b.getHighValue(); Double xfocus = b.getFocus(); - template = "$xfocus$\t$xlow$\t$xhigh$"; + String xdesc = b.getDescription(); + template = "$xdesc$\t$xfocus$\t$xlow$\t$xhigh$"; for (int ix=1; ix<x.getDataset().getXAxes().size(); ix++){ + template=template.concat("\t$val" + Integer.toString(ix) + "desc$"); template=template.concat("\t$val" + Integer.toString(ix) + "$"); template=template.concat("\t$val" + Integer.toString(ix) + "low$"); template=template.concat("\t$val" + Integer.toString(ix) + "high$"); } // template=template.concat("\t$yval$"); row.setTemplate(template); + row.setAttribute("xdesc", xdesc); row.setAttribute("xfocus", xfocus); row.setAttribute("xlow", xlow); row.setAttribute("xhigh", xhigh); for (int ix=1; ix<x.getDataset().getXAxes().size(); ix++){ if(x.getDataset().getXAxis(ix+1).getBin(r) != null){ + row.setAttribute("val" + Integer.toString(ix)+"desc",x.getDataset().getXAxis(ix+1).getBin(r).getDescription()); row.setAttribute("val" + Integer.toString(ix),x.getDataset().getXAxis(ix+1).getBin(r).getFocus()); row.setAttribute("val" + Integer.toString(ix)+"low",x.getDataset().getXAxis(ix+1).getBin(r).getLowValue()); row.setAttribute("val" + Integer.toString(ix)+"high",x.getDataset().getXAxis(ix+1).getBin(r).getHighValue()); Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/PyRootFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -123,7 +123,7 @@ out = s.toString(); } } catch (NullPointerException npe) { - out = "# Can't render this plot, due to missing/incompatible information: please report this problem!\n\n"; + out = "# Can't render this plot, due to missing/incompatible information\n\n"; } return out; } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/RootFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -150,7 +150,7 @@ out += s.toString(); } } catch (NullPointerException npe) { - out += " // Can't render this plot, due to missing/incompatible information: please report this problem!\n\n"; + out += " // Can't render this plot, due to missing/incompatible information\n\n"; } return out; } Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YodaFormatter.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YodaFormatter.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/formats/YodaFormatter.java Wed Dec 11 16:36:28 2013 (r1725) @@ -93,7 +93,7 @@ asYODA = s.toString(); } } catch (NullPointerException npe) { - asYODA = "# Can't render this plot, due to missing/incompatible information: please report this problem!\n\n"; + asYODA = "# Can't render this plot, due to missing/incompatible information\n\n"; } return asYODA; Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java ============================================================================== --- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Sun Dec 8 15:04:50 2013 (r1724) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java Wed Dec 11 16:36:28 2013 (r1725) @@ -48,6 +48,7 @@ // writer.element("p"); writer.attributes("class", "datasetcomments"); boolean verbatim = false; + boolean plotit = true; for (String comment : _dataset.getComments()) { if(!comment.startsWith("Location")){ if(comment.startsWith("VERBATIM")){verbatim = true;} @@ -287,6 +288,7 @@ writer.attributes("class","multiple qualifier_class"); if(store[nmy][i] != null) { if(nmy>0){ writer.write( store[nmy][i].substring(ii+1)); } + // if(nmy<0){ writer.write( store[nmy][i].substring(ii+1)); } else { writer.write( store[nmy][i]); } } writer.end(); @@ -378,6 +380,7 @@ boolean asymmfocus = false; boolean haswidth = false; for (Bin b : x.getBins()) { + if(b.getDescription() !=null) { plotit=false; } if (b.getLowValue() != null && b.getHighValue() != null && b.getFocus() != null) { double diff = b.getFocus() - (b.getLowValue() + b.getHighValue()) / 2.0; if (Math.abs(diff/b.getFocus()) > 1E-6) { @@ -624,6 +627,7 @@ // Alternative formats (link from table list) /// @todo Move to component template or separate component + if(plotit==true){ writer.element("tr"); writer.attributes("class", "altformats"); for (int ix = 1; ix <= nx; ix++) { @@ -649,14 +653,24 @@ // writer.element("br"); writer.end(); // Plot link - writer.element("a"); - writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); - writer.attributes("title", "Display this table in graphical form"); - writer.write("Plot"); - writer.end(); - - writer.element("br"); writer.end(); - + if(nx==1){ + writer.element("a"); + writer.attributes("href", baseurl + "/plot" + urlparts + "/x01/y" + iy); + writer.attributes("title", "Display this table in graphical form"); + writer.write("Plot"); + writer.end(); + writer.element("br"); writer.end(); + } + else { + for (int nxx=1; nxx<=nx; nxx++){ + writer.element("a"); + writer.attributes("href", baseurl + "/plot" + urlparts + "/x0"+nxx+"/y" + iy); + writer.attributes("title", "Display this table in graphical form using xaxis "+nxx); + writer.write("Plot v x"+nxx); + writer.end(); + writer.element("br"); writer.end(); + } + } // Plot selection link writer.element("a"); writer.attributes("href", baseurl + "/saveplot?string=" + getSearchString() + "&plot=" + _dataset.getPaper().getId() + "ds" + _dataset.getId() + "ya" + iy); @@ -667,6 +681,7 @@ writer.end(); //td } writer.end(); //tr + } } // end "full format only" writer.end(); //table
More information about the HepData-svn mailing list |