Java Code Examples for org.jfree.chart.axis.NumberAxis#getRange()

The following examples show how to use org.jfree.chart.axis.NumberAxis#getRange() . 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: XYBarRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYBarChart("Test Chart", "X",
            false, "Y", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 2
Source File: XYBarRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYBarChart("Test Chart", "X",
            false, "Y", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 3
Source File: StackedXYBarRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
public void testFindDomainBounds() {
    TableXYDataset dataset 
            = RendererXYPackageTests.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, 
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYBarRenderer());
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 4
Source File: XYLineAndShapeRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRangeIncludesZero(false);
    Range bounds = rangeAxis.getRange();
    assertFalse(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertTrue(bounds.contains(5.0));
    assertFalse(bounds.contains(6.0));
}
 
Example 5
Source File: XYBarRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYBarChart("Test Chart", "X",
            false, "Y", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 6
Source File: XYLineAndShapeRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 7
Source File: StackedXYBarRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset,
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYBarRenderer());
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 8
Source File: XYBarRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYBarChart("Test Chart", "X",
            false, "Y", dataset, PlotOrientation.VERTICAL, false, false,
            false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.3));
    assertTrue(bounds.contains(0.5));
    assertTrue(bounds.contains(2.5));
    assertFalse(bounds.contains(2.8));
}
 
Example 9
Source File: XYLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
public void testFindDomainBounds() {
    XYSeriesCollection dataset 
            = RendererXYPackageTests.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, 
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 10
Source File: XYLineAndShapeRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 11
Source File: XYLineAndShapeRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 12
Source File: XYLineAndShapeRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 13
Source File: XYLineAndShapeRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Check that the renderer is calculating the domain bounds correctly.
 */
@Test
public void testFindDomainBounds() {
    XYSeriesCollection dataset
            = RendererXYPackageUtils.createTestXYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setAutoRangeIncludesZero(false);
    Range bounds = domainAxis.getRange();
    assertFalse(bounds.contains(0.9));
    assertTrue(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertFalse(bounds.contains(2.10));
}
 
Example 14
Source File: StackedXYBarRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset,
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYBarRenderer());
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}
 
Example 15
Source File: XYLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageTests.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", 
            "X", "Y", dataset, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRangeIncludesZero(false);
    Range bounds = rangeAxis.getRange();
    assertFalse(bounds.contains(1.0));
    assertTrue(bounds.contains(2.0));
    assertTrue(bounds.contains(5.0));
    assertFalse(bounds.contains(6.0));
}
 
Example 16
Source File: StackedXYAreaRendererTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}
 
Example 17
Source File: StackedXYAreaRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}
 
Example 18
Source File: StackedXYBarRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset,
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYBarRenderer());
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}
 
Example 19
Source File: StackedXYAreaRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL,
            false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}
 
Example 20
Source File: StackedXYBarRendererTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Check that the renderer is calculating the range bounds correctly.
 */
@Test
public void testFindRangeBounds() {
    TableXYDataset dataset
            = RendererXYPackageUtils.createTestTableXYDataset();
    JFreeChart chart = ChartFactory.createStackedXYAreaChart(
            "Test Chart", "X", "Y", dataset,
            PlotOrientation.VERTICAL, false, false, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StackedXYBarRenderer());
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    Range bounds = rangeAxis.getRange();
    assertTrue(bounds.contains(6.0));
    assertTrue(bounds.contains(8.0));
}