Package plotter.xy

Examples of plotter.xy.SimpleXYDataset$MinMaxChangeListener


        paints[0]++;
        }
      }
    };
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(1000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    frame.addPlotLine(line);

    yAxis.setStart(-1.2);
    yAxis.setEnd(1.2);
    xAxis.setStart(-1.2);
    xAxis.setEnd(1.2);

    final int n = 2000;
    for(int x = 0; x <= n; x++) {
      double theta = x / (double) n * 2 * Math.PI;
      double x2 = Math.cos(theta) + .2 * Math.cos(theta * 20);
      double y2 = Math.sin(theta) + .2 * Math.sin(theta * 20);
      d.add(x2, y2);
    }

    frame.setSize(400, 300);
    frame.setVisible(true);
   
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
      int x = 2000;


      @Override
      public void run() {
        x++;
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            double theta = x / (double) n * 2 * Math.PI;
            double x2 = Math.cos(theta) + .2 * Math.cos(theta * 20);
            double y2 = Math.sin(theta) + .2 * Math.sin(theta * 20);
            d.add(x2, y2);
            if(x % 10 == 0 && paints[0] > 0) {
              System.out.println("Average paint time: " + paintTime[0] / paints[0]);
            }
          }
        });
View Full Code Here


    XYAxis yAxis = frame.getYAxis();
    LinearXYPlotLine[] lines = new LinearXYPlotLine[8];
    SimpleXYDataset[] datasets = new SimpleXYDataset[lines.length];
    for(int i = 0; i < lines.length; i++) {
      LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
      SimpleXYDataset d = new SimpleXYDataset(line);
      d.setMaxCapacity(1000);
      d.setXData(line.getXData());
      d.setYData(line.getYData());
      frame.addPlotLine(line);
      lines[i] = line;
      datasets[i] = d;
    }

    yAxis.setStart(0);
    yAxis.setEnd(11);
    xAxis.setStart(0);
    xAxis.setEnd(2 * Math.PI);

    lines[0].setMissingPointMode(MissingPointMode.NONE);
    lines[1].setMissingPointMode(MissingPointMode.LEFT);
    lines[2].setMissingPointMode(MissingPointMode.RIGHT);
    lines[3].setMissingPointMode(MissingPointMode.BOTH);
    lines[4].setMissingPointMode(MissingPointMode.NONE);
    lines[5].setMissingPointMode(MissingPointMode.LEFT);
    lines[6].setMissingPointMode(MissingPointMode.RIGHT);
    lines[7].setMissingPointMode(MissingPointMode.BOTH);

    lines[0].setForeground(Color.white);
    lines[1].setForeground(Color.blue);
    lines[2].setForeground(Color.cyan);
    lines[3].setForeground(Color.gray);
    lines[4].setForeground(Color.green);
    lines[5].setForeground(Color.magenta);
    lines[6].setForeground(Color.orange);
    lines[7].setForeground(Color.red);

    // Note that line[0] is at the top
    for(int i = 0; i < datasets.length; i++) {
      SimpleXYDataset d = datasets[i];
      double offset = datasets.length - 1 - i;
      if(i >= datasets.length / 2) {
        d.add(0, Double.NaN);
      }
      d.add(1, 1.5 + offset);
      d.add(2, 1 + offset);
      d.add(3, Double.NaN);
      d.add(4, 1.25 + offset);
      d.add(5, 1.75 + offset);
      if(i >= datasets.length / 2) {
        d.add(6, Double.NaN);
      }
    }

    frame.setSize(400, 300);
    frame.setVisible(true);
View Full Code Here

    xAxis.setTickMarkCalculator(new TimeTickMarkCalculator());
    xAxis.setFormat(new DateNumberFormat(new SimpleDateFormat("yyyy-MM-dd\nHH:mm:ss.SSS")));

    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(1000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    final XYMarkerLine marker = new XYMarkerLine(xAxis, 60);
    marker.setForeground(Color.yellow);
    XYPlotContents contents = frame.getContents();
    contents.add(marker);
    final XYMarkerLine marker2 = new XYMarkerLine(yAxis, .5);
    marker2.setForeground(Color.red);
    contents.add(marker2);
    frame.addPlotLine(line);

    yAxis.setStart(-1.2);
    yAxis.setEnd(1.2);
    xAxis.setStart(0);
    xAxis.setEnd(10);

    frame.getLocationDisplay().setFormat(new MessageFormat("<html><b>X:</b> {0,date,HH:mm:ss} &nbsp; <b>Y:</b> {1}</html>"));
    frame.getSlopeLineDisplay().setFormat(new MessageFormat("<html><b>&Delta;x:</b> {0,date,HH:mm:ss}  <b>&Delta;y:</b> {1}</html>"));

    for(int x = 0; x < 900; x++) {
      double x2 = x / 10.0;
      double y2 = Math.sin(x2 / 10.0);
      d.add(x2, y2);
    }
    timer.schedule(new TimerTask() {
      int x = 0;


      @Override
      public void run() {
        x++;
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            long now = System.currentTimeMillis();
            xAxis.setStart(now / 1000 * 1000 - 9000);
            xAxis.setEnd(now / 1000 * 1000 + 1000);
            double x2 = now;
            double y2 = Math.sin(x2 / 2000.0);
            d.add(x2, y2);
            marker.setValue(x2);
            marker2.setValue(y2);
          }
        });
      }
View Full Code Here

    JPanel uncompressedContents = new JPanel();
    contentPane.add(uncompressedContents);
    final JPanel compressedContents = new JPanel();
    contentPane.add(compressedContents);
    contentPane.setLayout(new GridLayout(2, 1));
    final SimpleXYDataset d = createPlot(uncompressedContents);
    final SimpleXYDataset d2 = createPlot(compressedContents);

    double value = 0;
    double signal = 0;
    Random random = new Random();
    for(int i = 0; i < 5000; i++) {
View Full Code Here

    new DefaultXYLayoutGenerator().generateLayout(plot);

    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(10000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    contents.add(line);
    contents.setComponentZOrder(grid, contents.getComponentCount() - 1);

    yAxis.setStart(-20);
    yAxis.setEnd(20);
View Full Code Here

    pointShape.lineTo(5, 5);
    pointShape.lineTo(5, -5);
    pointShape.lineTo(-5, -5);
    line.setPointFill(pointShape);
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(1000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    frame.addPlotLine(line);

    yAxis.setStart(-10);
    yAxis.setEnd(10);
    xAxis.setStart(-10);
    xAxis.setEnd(10);

    for(int p = 0; p <= 10; p++) {
      double r = p;
      double theta = p;
      double x = r * Math.cos(theta);
      double y = r * Math.sin(theta);
      d.add(x, y);
    }

    frame.setSize(400, 300);
    frame.setVisible(true);
  }
View Full Code Here

    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));
    contentPane.add(plot);

    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(10000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    contents.add(line);
    contents.setComponentZOrder(grid, contents.getComponentCount() - 1);

    if(invertY) {
      yAxis.setStart(200);
View Full Code Here

    this.maxPoints = maxPoints;
  }

  public ScatterXYPlotLine addDataset (String key, Color c) {
    ScatterXYPlotLine plotLine = new ScatterXYPlotLine(getXAxis(), getYAxis());
    SimpleXYDataset data = new SimpleXYDataset(plotLine);
    plotLines.put(key, plotLine);
    dataSet.put(key, data);
    contents.add(plotLine);
    plotLine.setForeground(c);
    return plotLine;
View Full Code Here

  @Override
  public AbstractPlotLine createPlotLine() {
    ScatterXYPlotLine plotterLine =
      new ScatterXYPlotLine(plotPanel.getXAxis(), plotPanel.getYAxis());
    plotterLine.setForeground(Color.PINK);
    SimpleXYDataset data = new SimpleXYDataset(plotterLine);
    plotPanel.getContents().add(plotterLine);
    return new PlotLineWrapper(plotterLine, data);
  }
View Full Code Here

  }
 
  @Override
  public PlotLine createLine() {
    ScatterXYPlotLine plotLine = new ScatterXYPlotLine(plot.getXAxis(), plot.getYAxis());
    SimpleXYDataset data = new SimpleXYDataset(plotLine);
    return new PlotterPlotLine(plotLine, data, rotated);
  }
View Full Code Here

TOP

Related Classes of plotter.xy.SimpleXYDataset$MinMaxChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.