Package plotter.xy

Examples of plotter.xy.XYMarkerLine


    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);
    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 - 5000);
            xAxis.setEnd(now + 5000);
            double x2 = now;
            double y2 = Math.sin(x2 / 2000.0);
            d.add(x2, y2);
            marker.setValue(x2);
          }
        });
      }
    }, 100, 100);
   
View Full Code Here


    line.setForeground(Color.white);
    final CompressingXYDataset d = new CompressingXYDataset(line, new DefaultCompressor());
    d.setTruncationPoint(0);
    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;
      long startTime = System.currentTimeMillis();


      @Override
      public void run() {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            long now = System.currentTimeMillis();
            xAxis.setStart(now / 1000 * 1000 - 9000);
            xAxis.setEnd(now / 1000 * 1000 + 1000);
            d.setTruncationPoint(xAxis.getStart());
            for(int i = 0; i < 10; i++) {
              double x2 = now + i;
              double y2 = Math.sin(x2 / 2000.0);
              d.add(x2, y2);
              marker.setValue(x2);
              marker2.setValue(y2);
              x++;
              if(x % 100 == 0) {
                System.out.println("Dataset size: " + d.getPointCount());
                System.out.println("Points per pixel: " + d.getPointCount() / (double) xAxis.getWidth());
                System.out.println("Points per second: " + 1000 * x / (double) (now - startTime));
View Full Code Here

    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);

    final MessageFormat f = new MessageFormat("<html><b>X:</b> {0,date,HH:mm:ss} &nbsp; <b>Y:</b> {1}</html>");
    frame.getLocationDisplay().setFormat(new Format() {
      @Override
      public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
        Object[] args = (Object[]) obj;
        double d = ((Number) args[0]).doubleValue();
        Object[] args2 = new Object[] { d + start, args[1] };
        return f.format(args2, toAppendTo, pos);
      }

      @Override
      public Object parseObject(String source, ParsePosition pos) {
        throw new UnsupportedOperationException();
      }
    });
    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() - start;
            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);
          }
        });
      }
    }, 100, 100);
   
View Full Code Here

    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);
          }
        });
      }
    }, 100, 100);
   
View Full Code Here

    syncTime = time;

    if(timeSyncLinePlot == null) {
      AbstractAxis timeAxis = plot.getTimeAxis();
      if (timeAxis instanceof XYAxis) { // Only decorate time-like axes; TODO: move to AbstractAxis?
        timeSyncLinePlot = new XYMarkerLine((XYAxis) timeAxis, time.getTimeInMillis());
        timeSyncLinePlot.setForeground(PlotConstants.TIME_SYNC_LINE_COLOR);
        XYPlotContents contents = plot.getPlotView().getContents();
        contents.add(timeSyncLinePlot);
        contents.revalidate();
      }
View Full Code Here

    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);
          }
        });
      }
    }, 100, 100);
   
View Full Code Here

TOP

Related Classes of plotter.xy.XYMarkerLine

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.