org.jfree.chart.axis.LogAxis Java Examples

The following examples show how to use org.jfree.chart.axis.LogAxis. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A simple test for the auto-range calculation looking at a
 * NumberAxis used as the range axis for a CategoryPlot.  In this
 * case, the original dataset is replaced with a new dataset.
 */
public void testAutoRange3() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
            "Value", dataset, false);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
    assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);

    // now replacing the dataset should update the axis range...
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    dataset2.setValue(900.0, "Row 1", "Column 1");
    dataset2.setValue(1000.0, "Row 1", "Column 2");
    plot.setDataset(dataset2);
    assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
    assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
}
 
Example #2
Source File: DefaultAxisEditor.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #3
Source File: DefaultAxisEditor.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #4
Source File: PolarPlotTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testTranslateToJava2D_LogAxis() {
    
    Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
    ValueAxis axis = new LogAxis();
    axis.setRange(1.0, 100.0);

    PolarPlot plot = new PolarPlot(null, axis, null);
    plot.setMargin(0);
    plot.setAngleOffset(0.0);

    Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
    assertEquals(75.0, point.getX(), 0.5);
    assertEquals(50.0, point.getY(), 0.5);

    point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
    assertEquals(50.0, point.getX(), 0.5);
    assertEquals(67.5, point.getY(), 0.5);

    point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
    assertEquals(73.0, point.getX(), 0.5);
    assertEquals(73.0, point.getY(), 0.5);
}
 
Example #5
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the auto-range for the range axis on an XYPlot is
 * working as expected.
 */
public void testXYAutoRange2() {
    XYSeries series = new XYSeries("Series 1");
    series.add(1.0, 1.0);
    series.add(2.0, 2.0);
    series.add(3.0, 3.0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot(
        "Test",
        "X",
        "Y",
        dataset,
        PlotOrientation.VERTICAL,
        false,
        false,
        false
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
 
Example #6
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the auto-range for the domain axis on an XYPlot is
 * working as expected.
 */
public void testXYAutoRange1() {
    XYSeries series = new XYSeries("Series 1");
    series.add(1.0, 1.0);
    series.add(2.0, 2.0);
    series.add(3.0, 3.0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot(
        "Test",
        "X",
        "Y",
        dataset,
        PlotOrientation.VERTICAL,
        false,
        false,
        false
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
 
Example #7
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A simple test for the auto-range calculation looking at a
 * NumberAxis used as the range axis for a CategoryPlot.  In this
 * case, the original dataset is replaced with a new dataset.
 */
public void testAutoRange3() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
            "Value", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
    assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);

    // now replacing the dataset should update the axis range...
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    dataset2.setValue(900.0, "Row 1", "Column 1");
    dataset2.setValue(1000.0, "Row 1", "Column 2");
    plot.setDataset(dataset2);
    assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
    assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
}
 
Example #8
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A simple test for the auto-range calculation looking at a
 * LogAxis used as the range axis for a CategoryPlot.
 */
public void testAutoRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createBarChart(
        "Test",
        "Categories",
        "Value",
        dataset,
        PlotOrientation.VERTICAL,
        false,
        false,
        false
    );
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.0, axis.getLowerBound(), EPSILON);
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
}
 
Example #9
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test the translation of Java2D values to data values.
 */
public void testTranslateJava2DToValue() {
    LogAxis axis = new LogAxis();
    axis.setRange(50.0, 100.0);
    Rectangle2D dataArea = new Rectangle2D.Double(10.0, 50.0, 400.0, 300.0);
    double y1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
    assertEquals(94.3874312681693, y1, EPSILON);
    double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
    assertEquals(94.3874312681693, y2, EPSILON);
    double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
    assertEquals(55.961246381405, x1, EPSILON);
    double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
    assertEquals(55.961246381405, x2, EPSILON);
    axis.setInverted(true);
    double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
    assertEquals(52.9731547179647, y3, EPSILON);
    double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
    assertEquals(52.9731547179647, y4, EPSILON);
    double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
    assertEquals(89.3475453695651, x3, EPSILON);
    double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
    assertEquals(89.3475453695651, x4, EPSILON);
}
 
Example #10
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    LogAxis a1 = new LogAxis("Test");
    LogAxis a2 = new LogAxis("Test");
    assertTrue(a1.equals(a2));

    a1.setBase(2.0);
    assertFalse(a1.equals(a2));
    a2.setBase(2.0);
    assertTrue(a1.equals(a2));

    a1.setSmallestValue(0.1);
    assertFalse(a1.equals(a2));
    a2.setSmallestValue(0.1);
    assertTrue(a1.equals(a2));

    a1.setMinorTickCount(8);
    assertFalse(a1.equals(a2));
    a2.setMinorTickCount(8);
    assertTrue(a1.equals(a2));
}
 
Example #11
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the auto-range for the range axis on an XYPlot is
 * working as expected.
 */
public void testXYAutoRange2() {
    XYSeries series = new XYSeries("Series 1");
    series.add(1.0, 1.0);
    series.add(2.0, 2.0);
    series.add(3.0, 3.0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y",
            dataset, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
 
Example #12
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the auto-range for the domain axis on an XYPlot is
 * working as expected.
 */
public void testXYAutoRange1() {
    XYSeries series = new XYSeries("Series 1");
    series.add(1.0, 1.0);
    series.add(2.0, 2.0);
    series.add(3.0, 3.0);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y",
            dataset, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
}
 
Example #13
Source File: PolarPlotTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testTranslateToJava2D_LogAxis() {
    
    Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
    ValueAxis axis = new LogAxis();
    axis.setRange(1.0, 100.0);

    PolarPlot plot = new PolarPlot(null, axis, null);
    plot.setMargin(0);
    plot.setAngleOffset(0.0);

    Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
    assertEquals(75.0, point.getX(), 0.5);
    assertEquals(50.0, point.getY(), 0.5);

    point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
    assertEquals(50.0, point.getX(), 0.5);
    assertEquals(67.5, point.getY(), 0.5);

    point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
    assertEquals(73.0, point.getX(), 0.5);
    assertEquals(73.0, point.getY(), 0.5);
}
 
Example #14
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test the translation of Java2D values to data values.
 */
public void testTranslateJava2DToValue() {
    LogAxis axis = new LogAxis();
    axis.setRange(50.0, 100.0);
    Rectangle2D dataArea = new Rectangle2D.Double(10.0, 50.0, 400.0, 300.0);
    double y1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
    assertEquals(94.3874312681693, y1, EPSILON);
    double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
    assertEquals(94.3874312681693, y2, EPSILON);
    double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
    assertEquals(55.961246381405, x1, EPSILON);
    double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
    assertEquals(55.961246381405, x2, EPSILON);
    axis.setInverted(true);
    double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
    assertEquals(52.9731547179647, y3, EPSILON);
    double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
    assertEquals(52.9731547179647, y4, EPSILON);
    double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
    assertEquals(89.3475453695651, x3, EPSILON);
    double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
    assertEquals(89.3475453695651, x4, EPSILON);
}
 
Example #15
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    LogAxis a1 = new LogAxis("Test");
    LogAxis a2 = new LogAxis("Test");
    assertTrue(a1.equals(a2));

    a1.setBase(2.0);
    assertFalse(a1.equals(a2));
    a2.setBase(2.0);
    assertTrue(a1.equals(a2));

    a1.setSmallestValue(0.1);
    assertFalse(a1.equals(a2));
    a2.setSmallestValue(0.1);
    assertTrue(a1.equals(a2));

    a1.setMinorTickCount(8);
    assertFalse(a1.equals(a2));
    a2.setMinorTickCount(8);
    assertTrue(a1.equals(a2));
}
 
Example #16
Source File: DefaultAxisEditor.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #17
Source File: DefaultAxisEditor.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #18
Source File: PolarPlotTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTranslateToJava2D_LogAxis() {
    
    Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
    ValueAxis axis = new LogAxis();
    axis.setRange(1.0, 100.0);

    PolarPlot plot = new PolarPlot(null, axis, null);
    plot.setMargin(0);
    plot.setAngleOffset(0.0);

    Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
    assertEquals(75.0, point.getX(), 0.5);
    assertEquals(50.0, point.getY(), 0.5);

    point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
    assertEquals(50.0, point.getX(), 0.5);
    assertEquals(67.5, point.getY(), 0.5);

    point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
    assertEquals(73.0, point.getX(), 0.5);
    assertEquals(73.0, point.getY(), 0.5);
}
 
Example #19
Source File: PolarPlotTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void testTranslateToJava2D_LogAxis() {
    
    Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
    ValueAxis axis = new LogAxis();
    axis.setRange(1.0, 100.0);

    PolarPlot plot = new PolarPlot(null, axis, null);
    plot.setMargin(0);
    plot.setAngleOffset(0.0);

    Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
    assertEquals(75.0, point.getX(), 0.5);
    assertEquals(50.0, point.getY(), 0.5);

    point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
    assertEquals(50.0, point.getX(), 0.5);
    assertEquals(67.5, point.getY(), 0.5);

    point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
    assertEquals(73.0, point.getX(), 0.5);
    assertEquals(73.0, point.getY(), 0.5);
}
 
Example #20
Source File: DefaultAxisEditor.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #21
Source File: DefaultAxisEditor.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A static method that returns a panel that is appropriate for the axis
 * type.
 *
 * @param axis  the axis whose properties are to be displayed/edited in
 *              the panel.
 *
 * @return A panel or {@code null} if axis is {@code null}.
 */
public static DefaultAxisEditor getInstance(Axis axis) {

    if (axis != null) {
        // figure out what type of axis we have and instantiate the
        // appropriate panel
        if (axis instanceof NumberAxis) {
            return new DefaultNumberAxisEditor((NumberAxis) axis);
        }
        if (axis instanceof LogAxis) {
            return new DefaultLogAxisEditor((LogAxis) axis);
        }
        else {
            return new DefaultAxisEditor(axis);
        }
    }
    else {
        return null;
    }

}
 
Example #22
Source File: PolarPlotTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
@Test
public void testTranslateToJava2D_LogAxis() {
    
    Rectangle2D dataArea = new Rectangle2D.Double(0.0, 0.0, 100.0, 100.0);
    ValueAxis axis = new LogAxis();
    axis.setRange(1.0, 100.0);

    PolarPlot plot = new PolarPlot(null, axis, null);
    plot.setMargin(0);
    plot.setAngleOffset(0.0);

    Point point = plot.translateToJava2D(0.0, 10.0, axis, dataArea );
    assertEquals(75.0, point.getX(), 0.5);
    assertEquals(50.0, point.getY(), 0.5);

    point = plot.translateToJava2D(90.0, 5.0, axis, dataArea );
    assertEquals(50.0, point.getX(), 0.5);
    assertEquals(67.5, point.getY(), 0.5);

    point = plot.translateToJava2D(45.0, 20.0, axis, dataArea );
    assertEquals(73.0, point.getX(), 0.5);
    assertEquals(73.0, point.getY(), 0.5);
}
 
Example #23
Source File: DefaultLogAxisEditor.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    LogAxis logAxis = (LogAxis) axis;
    if (!isAutoTickUnitSelection()) {
        logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
    }
}
 
Example #24
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the setLowerBound() method.
 */
public void testSetLowerBound() {
    LogAxis axis = new LogAxis("X");
    axis.setRange(0.0, 10.0);
    axis.setLowerBound(5.0);
    assertEquals(5.0, axis.getLowerBound(), EPSILON);
    axis.setLowerBound(10.0);
    assertEquals(10.0, axis.getLowerBound(), EPSILON);
    assertEquals(11.0, axis.getUpperBound(), EPSILON);
}
 
Example #25
Source File: DefaultLogAxisEditor.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    LogAxis logAxis = (LogAxis) axis;
    if (!isAutoTickUnitSelection()) {
        logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
    }
}
 
Example #26
Source File: DefaultLogAxisEditor.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    LogAxis logAxis = (LogAxis) axis;
    if (!isAutoTickUnitSelection()) {
        logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
    }
}
 
Example #27
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    LogAxis a1 = new LogAxis("Test");
    LogAxis a2 = new LogAxis("Test");
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
 
Example #28
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the setLowerBound() method.
 */
public void testSetLowerBound() {
    LogAxis axis = new LogAxis("X");
    axis.setRange(0.0, 10.0);
    axis.setLowerBound(5.0);
    assertEquals(5.0, axis.getLowerBound(), EPSILON);
    axis.setLowerBound(10.0);
    assertEquals(10.0, axis.getLowerBound(), EPSILON);
    assertEquals(11.0, axis.getUpperBound(), EPSILON);
}
 
Example #29
Source File: DefaultLogAxisEditor.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the properties of the specified axis to match the properties
 * defined on this panel.
 *
 * @param axis  the axis.
 */
@Override
public void setAxisProperties(Axis axis) {
    super.setAxisProperties(axis);
    LogAxis logAxis = (LogAxis) axis;
    if (!isAutoTickUnitSelection()) {
        logAxis.setTickUnit(new NumberTickUnit(manualTickUnitValue));
    }
}
 
Example #30
Source File: LogAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A simple test for the auto-range calculation looking at a
 * LogAxis used as the range axis for a CategoryPlot.
 */
public void testAutoRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createBarChart("Test", "Categories",
            "Value", dataset, false);
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    LogAxis axis = new LogAxis("Log(Y)");
    plot.setRangeAxis(axis);
    assertEquals(0.0, axis.getLowerBound(), EPSILON);
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
}