Examples of SlopeLine


Examples of plotter.xy.SlopeLine

    Timer timer = new Timer();
    final int numPlots = plotsx * plotsy;
    final Axis[] xAxes = new Axis[numPlots];
    final Axis[] yAxes = new Axis[numPlots];
    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);
View Full Code Here

Examples of plotter.xy.SlopeLine

    locationDisplay.setFont(new Font("Arial", 0, 12));
    locationDisplay.setFormat(new MessageFormat("<html><b>X:</b> {0} &nbsp; <b>Y:</b> {1}</html>"));
    locationDisplay.attach(plot);
    plot.add(locationDisplay);

    SlopeLine slopeLine = new SlopeLine();
    slopeLine.setForeground(Color.white);
    slopeLine.attach(plot);

    slopeLineDisplay = new SlopeLineDisplay();
    slopeLine.addListenerForPlot(plot, slopeLineDisplay);
    slopeLineDisplay.setFont(new Font("Arial", 0, 12));
    slopeLineDisplay.setForeground(Color.white);
    slopeLineDisplay.setFormat(new MessageFormat("<html><b>&Delta;x:</b> {0}  <b>&Delta;y:</b> {1}</html>"));
    plot.add(slopeLineDisplay);
View Full Code Here

Examples of plotter.xy.SlopeLine

    locationDisplay.setFont(new Font("Arial", 0, 12));
    locationDisplay.setFormat(new MessageFormat("<html><b>X:</b> {0} &nbsp; <b>Y:</b> {1}</html>"));
    locationDisplay.attach(plot);
    plot.add(locationDisplay);

    SlopeLine slopeLine = new SlopeLine();
    slopeLine.setForeground(Color.white);
    slopeLine.attach(plot);

    SlopeLineDisplay slopeLineDisplay = new SlopeLineDisplay();
    slopeLine.addListenerForPlot(plot, slopeLineDisplay);
    slopeLineDisplay.setFont(new Font("Arial", 0, 12));
    slopeLineDisplay.setForeground(Color.white);
    slopeLineDisplay.setFormat(new MessageFormat("<html><b>&Delta;x:</b> {0}  <b>&Delta;y:</b> {1}</html>"));
    plot.add(slopeLineDisplay);
View Full Code Here

Examples of plotter.xy.SlopeLine

    locationDisplay.setFont(new Font("Arial", 0, 12));
    locationDisplay.setFormat(new MessageFormat("<html><b>X:</b> {0} &nbsp; <b>Y:</b> {1}</html>"));
    locationDisplay.attach(plot);
    plot.add(locationDisplay);

    SlopeLine slopeLine = new SlopeLine();
    slopeLine.setForeground(Color.white);
    slopeLine.attach(plot);
   
    SlopeLineDisplay slopeLineDisplay = new SlopeLineDisplay();
    slopeLine.addListenerForPlot(plot, slopeLineDisplay);
    slopeLineDisplay.setFont(new Font("Arial", 0, 12));
    slopeLineDisplay.setForeground(Color.white);
    slopeLineDisplay.setFormat(new MessageFormat("<html><b>&Delta;x:</b> {0}  <b>&Delta;y:</b> {1}</html>"));
    plot.add(slopeLineDisplay);
View Full Code Here

Examples of plotter.xy.SlopeLine

  /**
   * Setup the slope dx, dy label that will be positioned at the top of the plot
   */
  @SuppressWarnings("serial")
  private void setupSlopeLineDisplay() {
    slopeLine = new SlopeLine();
    slopeLine.attach(parentPlot.getPlotView());
    slopeLine.addListenerForPlot(parentPlot.getPlotView(), slopeLabel);
    slopeLine.addListenerForPlot(parentPlot.getPlotView(), new SlopeLine.Listener() {
      @Override
      public void slopeLineUpdated(SlopeLine line, XYPlot plot, double arg2, double arg3, double arg4, double arg5) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.