Package plotter.xy

Examples of plotter.xy.SimpleXYDataset$MinMaxChangeListener


    yAxis.setPreferredSize(new Dimension(100, 50));
    xAxis.setStartMargin(100);

    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.Y);
    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(0);
    yAxis.setEnd(10);
    xAxis.setStart(-1.2);
    xAxis.setEnd(1.2);

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

    timer.schedule(new TimerTask() {
      int x = 0;


      @Override
      public void run() {
        x++;
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            long now = System.currentTimeMillis();
            yAxis.setStart(now / 1000 * 1000 - 9000);
            yAxis.setEnd(now / 1000 * 1000 + 1000);
            double y2 = now;
            double x2 = Math.sin(y2 / 2000.0);
            d.add(x2, y2);
            marker.setValue(x2);
            marker2.setValue(y2);
          }
        });
      }
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.