Exemple #1
0
  public void plot(AbstractDrawer draw, Color[] c) {
    if (!visible) return;

    boolean monoColor = false;
    if (c.length == 1) {
      monoColor = true;
    } else if (c.length != XY.length) {
      throw new IllegalArgumentException("Color array length must match length of data array. ");
    }

    draw.setLineType(AbstractDrawer.CONTINOUS_LINE);
    for (int i = 0; i < XY.length - 1; i++) {
      double[] begin = XY[i].clone();
      double[] end = XY[i + 1].clone();
      end[end.length - 1] = XY[i][end.length - 1];
      draw.setColor(monoColor ? c[0] : c[i]);
      draw.drawLine(begin, end);
    }

    // System.out.println(Array.toString(XY));

    if (link) {
      for (int i = 0; i < XY.length - 2; i++) {
        double[] begin = XY[i + 1].clone();
        double[] end = XY[i + 1].clone();
        begin[begin.length - 1] = XY[i][begin.length - 1];
        draw.drawLine(begin, end);
      }
    }
    // System.out.println(Array.toString(XY));

  }