Package plotter.xy

Examples of plotter.xy.XYAxis


  public static void main(String[] args) {
    XYPlotFrame frame = new XYPlotFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    yAxis.setPreferredSize(new Dimension(75, 50));
    xAxis.setStartMargin(75);
    ((LinearXYAxis) yAxis).setFormat(new ChoiceFormat(new double[] {-Double.POSITIVE_INFINITY, 0, 1, 2, 2.000001}, new String[] {"", "red",
        "green", "blue", ""}));
    ((LinearXYAxis) yAxis).setTickMarkCalculator(new IntegerTickMarkCalculator());
    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
    line.setForeground(Color.white);
    line.setLineMode(LineMode.STEP_YX);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    d.setMaxCapacity(1000);
    d.setXData(line.getXData());
    d.setYData(line.getYData());
    frame.addPlotLine(line);

    yAxis.setStart(-1);
    yAxis.setEnd(3);
    xAxis.setStart(0);
    xAxis.setEnd(10);

    d.add(2, 0);
    d.add(3, 1);
View Full Code Here


    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();
    Timer timer = new Timer();

    final LinearXYAxis xAxis = (LinearXYAxis) frame.getXAxis();
    final XYAxis yAxis = frame.getYAxis();
    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);
    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>"));
View Full Code Here

  public static void main(String[] args) {
    XYPlotFrame frame = new XYPlotFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    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());
    frame.addPlotLine(line);

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

    for(int x = 0; x <= 100; x++) {
      double x2 = x / 100.0 * 2 * Math.PI;
 
View Full Code Here

  public static void main(String[] args) {
    XYPlotFrame frame = new XYPlotFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    List<Shape> shapes = new ArrayList<Shape>();
    shapes.add(Shapes.square(5));
    shapes.add(Shapes.circle(5));
    shapes.add(Shapes.triangleUp(5));
    shapes.add(Shapes.triangleDown(5));
    shapes.add(Shapes.shuttle(5));
    shapes.add(Shapes.star(5));
    shapes.add(Shapes.plus(5));
    shapes.add(Shapes.x(5));
    LinearXYPlotLine[] lines = new LinearXYPlotLine[shapes.size() * 2];
    SimpleXYDataset[] datasets = new SimpleXYDataset[lines.length];
    for(int i = 0; i < lines.length; i++) {
      LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
      line.setForeground(Color.white);
      SimpleXYDataset d = new SimpleXYDataset(line);
      d.setMaxCapacity(1000);
      d.setXData(line.getXData());
      d.setYData(line.getYData());
      frame.addPlotLine(line);
      if(i % 2 == 0) {
        line.setPointOutline(shapes.get(i / 2));
      } else {
        line.setPointFill(shapes.get(i / 2));
      }
      lines[i] = line;
      datasets[i] = d;
    }

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

    for(int x = 0; x <= 10; x++) {
      double x2 = x / 10.0 * 2 * Math.PI;
 
View Full Code Here

    final SimpleXYDataset[][] datasets = new SimpleXYDataset[numPlots][linesPerPlot];
    SlopeLine slopeLine = new SlopeLine();
    slopeLine.setForeground(Color.white);
    for(int i = 0; i < numPlots; i++) {
      final XYPlot plot = new XYPlot();
      final XYAxis xAxis = new LinearXYAxis(XYDimension.X);
      final XYAxis yAxis = new LinearXYAxis(XYDimension.Y);
      xAxis.setPreferredSize(new Dimension(1, 30));
      yAxis.setPreferredSize(new Dimension(40, 1));
      xAxis.setForeground(Color.white);
      yAxis.setForeground(Color.white);
      xAxis.setTextMargin(10);
      yAxis.setTextMargin(10);
      plot.add(xAxis);
      plot.add(yAxis);
      plot.setXAxis(xAxis);
      plot.setYAxis(yAxis);
      plot.setBackground(Color.darkGray);
      XYGrid grid = new XYGrid(xAxis, yAxis);
      grid.setForeground(Color.lightGray);
      XYPlotContents contents = new XYPlotContents();
      contents.setBackground(Color.black);
      plot.add(contents);
      contents.add(grid);
      plot.setPreferredSize(new Dimension(150, 100));

      new DefaultXYLayoutGenerator().generateLayout(plot);

      for(int j = 0; j < linesPerPlot; j++) {
        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());
        contents.add(line);

        for(int x = 0; x < 900; x++) {
          double x2 = x / 10.0;
          double y2 = Math.sin(x2 / 10.0 + Math.PI * j / (double) linesPerPlot);
          d.add(x2, y2);
        }
        datasets[i][j] = d;
      }
      slopeLine.attach(plot);

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

      container.add(plot);

View Full Code Here

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();
    Timer timer = new Timer();

    final LinearXYAxis xAxis = (LinearXYAxis) frame.getXAxis();
    final XYAxis yAxis = frame.getYAxis();
    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 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>"));
View Full Code Here

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();
    Timer timer = new Timer();

    final LinearXYAxis xAxis = (LinearXYAxis) frame.getXAxis();
    final XYAxis yAxis = frame.getYAxis();
    xAxis.setTickMarkCalculator(new TimeTickMarkCalculator());
    final long start = System.currentTimeMillis();
    xAxis.setFormat(new DateNumberFormat(new SimpleDateFormat("yyyy-MM-dd\nHH:mm:ss.SSS"), start));

    final LinearXYPlotLine line = new LinearXYPlotLine(xAxis, yAxis, XYDimension.X);
    line.setXData(new DoubleDataFloat());
    line.setYData(new DoubleDataFloat());
    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() {
View Full Code Here

  public static void main(String[] args) {
    XYPlotFrame frame = new XYPlotFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    ((LinearXYAxis)xAxis).setFormat(new DecimalFormat("0.0"));
    xAxis.setLabelRotation(Rotation.CCW);
    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());
    frame.addPlotLine(line);

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

    for(int x = 0; x <= 100; x++) {
      double x2 = x / 100.0 * 2 * Math.PI;
 
View Full Code Here

      }
    };
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    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());
    frame.addPlotLine(line);

    yAxis.setStart(-1.2);
    yAxis.setEnd(3.2);
    xAxis.setStart(0);
    xAxis.setEnd(2 * Math.PI);

    for(int x = 0; x <= 100; x++) {
      double x2 = x / 100.0 * 2 * Math.PI;
 
View Full Code Here

  public static void main(String[] args) {
    XYPlotFrame frame = new XYPlotFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setup();

    XYAxis xAxis = frame.getXAxis();
    XYAxis yAxis = frame.getYAxis();
    final ScatterXYPlotLine line = new ScatterXYPlotLine(xAxis, yAxis);
    line.setForeground(Color.white);
    final SimpleXYDataset d = new SimpleXYDataset(line);
    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);

    int n = 2000;
    for(int x = 0; x <= n; x++) {
View Full Code Here

TOP

Related Classes of plotter.xy.XYAxis

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.