View Javadoc

1   package org.catacomb.dataview;
2   
3   import java.awt.Color;
4   
5   import org.catacomb.datalish.Box;
6   import org.catacomb.graph.gui.Painter;
7   
8   
9   public class LinePlotElement extends PlotElement {
10  
11      double[] xpts;
12      double[] ypts;
13  
14  
15      public LinePlotElement(double[] x, double[] y) {
16          this(x, y, Color.white);
17      }
18  
19      public LinePlotElement(double[] x, double[] y, Color c) {
20          xpts = x;
21          ypts = y;
22          col = c;
23      }
24  
25      public LinePlotElement(double[] x, double[] y, Color c, String s) {
26          this(x, y, c);
27          label = s;
28      }
29  
30      public void instruct(Painter p) {
31          p.setColor(col);
32          p.drawPolyline(xpts, ypts, xpts.length);
33      }
34  
35  
36      public void push(Box b) {
37          b.push(xpts, ypts);
38      }
39  
40  }