[Swift-commit] r4644 - usertools/plotter/src/plotter
jonmon at ci.uchicago.edu
jonmon at ci.uchicago.edu
Mon Jun 20 15:41:18 CDT 2011
Author: jonmon
Date: 2011-06-20 15:41:18 -0500 (Mon, 20 Jun 2011)
New Revision: 4644
Modified:
usertools/plotter/src/plotter/Plots.java
usertools/plotter/src/plotter/Util.java
Log:
moved static collection method from Util to Plots
Modified: usertools/plotter/src/plotter/Plots.java
===================================================================
--- usertools/plotter/src/plotter/Plots.java 2011-06-20 20:21:03 UTC (rev 4643)
+++ usertools/plotter/src/plotter/Plots.java 2011-06-20 20:41:18 UTC (rev 4644)
@@ -1,11 +1,16 @@
package plotter;
+import plotter.Util.*;
import java.awt.Font;
+
import java.util.Properties;
+import java.util.List;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.title.LegendTitle;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
/**
* Reusable JFreeChart-specific functions
* @author wozniak
@@ -13,6 +18,42 @@
*/
public class Plots
{
+
+ /**
+ Stores the label as the Series key.
+ Stores the filename as the Series description.
+ */
+ static XYSeriesCollection collection(List<double[][]> data,
+ List<String> labels,
+ List<String> names)
+ {
+ final XYSeriesCollection collection = new XYSeriesCollection();
+
+ int count = 0;
+ for (double[][] d : data)
+ {
+ String label = "data: " + count;
+ try
+ {
+ String s = labels.get(count);
+ if( !(s.equals("")) )
+ label = s;
+ }
+ catch (IndexOutOfBoundsException e)
+ {}
+
+ Util.verbose( "label: "+label );
+ XYSeries series = new XYSeries(label);
+ for (int i = 0; i < d.length; i++)
+ series.add(d[i][0], d[i][1]);
+
+ series.setDescription(names.get(count));
+ collection.addSeries(series);
+ count++;
+ }
+ return collection;
+ }
+
static void setupLegend(JFreeChart chart,
Properties properties)
{
Modified: usertools/plotter/src/plotter/Util.java
===================================================================
--- usertools/plotter/src/plotter/Util.java 2011-06-20 20:21:03 UTC (rev 4643)
+++ usertools/plotter/src/plotter/Util.java 2011-06-20 20:41:18 UTC (rev 4644)
@@ -3,54 +3,10 @@
/**
* Plot data helpers.
* */
-
-import java.util.List;
-
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
public class Util
{
static boolean v = false;
- /**
- Stores the label as the Series key.
- Stores the filename as the Series description.
- */
- static XYSeriesCollection collection(List<double[][]> data,
- List<String> labels,
- List<String> names)
- {
- final XYSeriesCollection collection = new XYSeriesCollection();
-
- int count = 0;
- for (double[][] d : data)
- {
- /* What does this do? */
- /* label is set to something but then immediately overwritten */
- /* That catch should not happen */
- String label = "data: " + count;
- try
- {
- String s = labels.get(count);
- if( !(s.equals("")) )
- label = s;
- }
- catch (IndexOutOfBoundsException e)
- {}
-
- Util.verbose( "label: "+label );
- XYSeries series = new XYSeries(label);
- for (int i = 0; i < d.length; i++)
- series.add(d[i][0], d[i][1]);
-
- series.setDescription(names.get(count));
- collection.addSeries(series);
- count++;
- }
- return collection;
- }
-
public static void fatal(String s)
{
System.err.println(s);
More information about the Swift-commit
mailing list