Example #1
0
  @Test
  public void testOriginFixedMode() throws Exception {
    plot.addSeries(series1, new LineAndPointFormatter());
    plot.centerOnDomainOrigin(5, 2, BoundaryMode.FIXED);
    plot.calculateMinMaxVals();

    assertEquals(3.0, plot.getCalculatedMinX());
    assertEquals(7.0, plot.getCalculatedMaxX());
  }
Example #2
0
  @Test
  public void testOriginAutoMode() throws Exception {
    plot.addSeries(series1, new LineAndPointFormatter());
    plot.centerOnDomainOrigin(5);
    plot.calculateMinMaxVals();

    assertEquals(10.0, plot.getCalculatedMaxX()); // symmetry is @ 10, not 9
    assertEquals(0.0, plot.getCalculatedMinX());

    plot.centerOnRangeOrigin(50);
    plot.calculateMinMaxVals();

    assertEquals(100.0, plot.getCalculatedMaxY());
    assertEquals(0.0, plot.getCalculatedMinY());
  }
Example #3
0
  @Test
  public void testOriginShrinkMode() throws Exception {
    plot.addSeries(series1, new LineAndPointFormatter());
    plot.centerOnDomainOrigin(5, null, BoundaryMode.SHRINNK);
    plot.calculateMinMaxVals();

    assertEquals(0.0, plot.getCalculatedMinX());
    assertEquals(10.0, plot.getCalculatedMaxX());

    // update with more extreme values...nothing should change in shrink mode:
    series1.setModel(numList2, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);

    assertEquals(0.0, plot.getCalculatedMinX());
    assertEquals(10.0, plot.getCalculatedMaxX());
  }
Example #4
0
  @Test
  public void testOriginGrowMode() throws Exception {
    plot.addSeries(series1, new LineAndPointFormatter());
    plot.centerOnDomainOrigin(5, null, BoundaryMode.GROW);
    plot.calculateMinMaxVals();

    assertEquals(0.0, plot.getCalculatedMinX());
    assertEquals(10.0, plot.getCalculatedMaxX());

    // introduce a larger domain set.  boundaries should change
    series1.setModel(numList2, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);
    plot.calculateMinMaxVals();

    assertEquals(-1.0, plot.getCalculatedMinX());
    assertEquals(11.0, plot.getCalculatedMaxX());

    // revert series model back to the previous set.  boundaries should remain the same
    series1.setModel(numList1, SimpleXYSeries.ArrayFormat.Y_VALS_ONLY);
    plot.calculateMinMaxVals();

    assertEquals(-1.0, plot.getCalculatedMinX());
    assertEquals(11.0, plot.getCalculatedMaxX());
  }