[Swift-commit] r5954 - usertools/plotter/src/plotter

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Mon Oct 1 19:42:34 CDT 2012


Author: wozniak
Date: 2012-10-01 19:42:34 -0500 (Mon, 01 Oct 2012)
New Revision: 5954

Modified:
   usertools/plotter/src/plotter/Lines.java
Log:
Support dotted lines


Modified: usertools/plotter/src/plotter/Lines.java
===================================================================
--- usertools/plotter/src/plotter/Lines.java	2012-10-01 19:38:47 UTC (rev 5953)
+++ usertools/plotter/src/plotter/Lines.java	2012-10-02 00:42:34 UTC (rev 5954)
@@ -3,6 +3,7 @@
 
 import gnu.getopt.Getopt;
 
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.geom.Rectangle2D;
 import java.io.*;
@@ -236,10 +237,12 @@
     for (int i = 0; i < plot.getSeriesCount(); i++)
     {
       Series series = collection.getSeries(i);
-      if (! showShape(series.getDescription()))
+      String description = series.getDescription();
+      if (! showShape(description))
         renderer.setSeriesShapesVisible(i, false);
-      if (! showLine(series.getDescription()))
+      if (! showLine(description))
         renderer.setSeriesLinesVisible(i, false);
+      formatLine(description, renderer, i);
     }
 
     Plots.setupLegend(chart, properties);
@@ -433,7 +436,19 @@
       return false;
     return true;
   }
-
+  
+  static BasicStroke dottedStroke = 
+    new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
+                    1.0f, new float[] {6.0f, 6.0f}, 0.0f);
+  
+  static void formatLine(String name, XYLineAndShapeRenderer renderer, int i)
+  {
+    System.out.println(name);
+    String lineStyle = properties.getProperty("line."+name); 
+    if ("dotted".equals(lineStyle))
+      renderer.setSeriesStroke(i, dottedStroke);
+  }
+  
   static String toString(double[][] array)
   {
     StringBuilder sb = new StringBuilder();




More information about the Swift-commit mailing list