Ejemplo n.º 1
0
  public void paintProbe(Graphics2D g2, int x1, int y1, int x2, int y2, double tmin, double tmax) {
    g2.setStroke(stroke);
    g2.setColor(color);

    int ppx = -1, ppy = -1;
    for (int i = 0; i < values.size(); i++) {
      Double v = values.get(i);
      if (v != null && tmax - tmin > 0.0) {
        double frac = (v - tmin) / (tmax - tmin);
        int pixY = y2 - (int) Math.round(frac * (y2 - y1));
        int pixX = x1 + (int) Math.floor((double) (i + 1) / (double) (values.size() + 2));

        if (ppx != -1) {
          g2.drawLine(ppx, ppy, pixX, pixY);
        }

        ppx = pixX;
        ppy = pixY;

      } else {
        ppx = ppy = -1;
      }
    }
  }
Ejemplo n.º 2
0
 public void paintItem(Graphics g, int x1, int y1, int x2, int y2) {
   int w = x2 - x1, h = y2 - y1;
   Graphics2D g2 = (Graphics2D) g;
   g2.setColor(Color.white);
   g2.fillRect(x1, y1, w, h);
 }