Esempio n. 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));

  }
Esempio n. 2
0
  public void plot(AbstractDrawer draw, Color c) {
    if (!visible) return;

    draw.setLineType(plotType);

    draw.setLineWidth(lineWidth);
    draw.getGraphics().setStroke(new BasicStroke((float) lineWidth));

    if (draw_dot) super.plot(draw, c);
    else {
      draw.setColor(c);

      int xyl = XY.length;
      if (xyl < PlotGlobals.limitPlotPoints || PlotGlobals.skipPointsOnPlot == false) {
        // plot all the points
        for (int i = 0; i < XY.length - 1; i++) draw.drawLine(XY[i], XY[i + 1]);
      } else {
        int skipPoints = ((int) (xyl / PlotGlobals.limitPlotPoints)) + 1;
        for (int i = 0; i < XY.length - 1 - skipPoints - 1; i += skipPoints)
          draw.drawLine(XY[i], XY[i + skipPoints + 1]);
      }
    }
  }