Search in sources :

Example 61 with ValueAxis

use of org.jfree.chart.axis.ValueAxis in project SIMVA-SoS by SESoS.

the class TimeSeriesChartTest method testReplaceDataset.

/**
 * Replaces the dataset and checks that it has changed as expected.
 */
@Test
public void testReplaceDataset() {
    // create a dataset...
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(10.0, 10.0);
    series1.add(20.0, 20.0);
    series1.add(30.0, 30.0);
    XYDataset dataset = new XYSeriesCollection(series1);
    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    XYPlot plot = (XYPlot) this.chart.getPlot();
    plot.setDataset(dataset);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);
    assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYPlot(org.jfree.chart.plot.XYPlot) ValueAxis(org.jfree.chart.axis.ValueAxis) XYDataset(org.jfree.data.xy.XYDataset) Range(org.jfree.data.Range) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) Test(org.junit.Test)

Example 62 with ValueAxis

use of org.jfree.chart.axis.ValueAxis in project SIMVA-SoS by SESoS.

the class XYLineChartTest method testReplaceDataset.

/**
 * Replaces the dataset and checks that it has changed as expected.
 */
@Test
public void testReplaceDataset() {
    // create a dataset...
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(10.0, 10.0);
    series1.add(20.0, 20.0);
    series1.add(30.0, 30.0);
    XYDataset dataset = new XYSeriesCollection(series1);
    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    XYPlot plot = (XYPlot) this.chart.getPlot();
    plot.setDataset(dataset);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);
    assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYPlot(org.jfree.chart.plot.XYPlot) ValueAxis(org.jfree.chart.axis.ValueAxis) XYDataset(org.jfree.data.xy.XYDataset) Range(org.jfree.data.Range) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) Test(org.junit.Test)

Example 63 with ValueAxis

use of org.jfree.chart.axis.ValueAxis in project SIMVA-SoS by SESoS.

the class XYBarChartTest method testReplaceDataset.

/**
 * Replaces the dataset and checks that it has changed as expected.
 */
@Test
public void testReplaceDataset() {
    // create a dataset...
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(10.0, 10.0);
    series1.add(20.0, 20.0);
    series1.add(30.0, 30.0);
    XYDataset dataset = new XYSeriesCollection(series1);
    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    XYPlot plot = (XYPlot) this.chart.getPlot();
    plot.setDataset(dataset);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);
    assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYPlot(org.jfree.chart.plot.XYPlot) ValueAxis(org.jfree.chart.axis.ValueAxis) IntervalXYDataset(org.jfree.data.xy.IntervalXYDataset) XYDataset(org.jfree.data.xy.XYDataset) Range(org.jfree.data.Range) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) Test(org.junit.Test)

Example 64 with ValueAxis

use of org.jfree.chart.axis.ValueAxis in project SIMVA-SoS by SESoS.

the class XYStepAreaChartTest method testReplaceDataset.

/**
 * Replaces the dataset and checks that it has changed as expected.
 */
@Test
public void testReplaceDataset() {
    // create a dataset...
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(10.0, 10.0);
    series1.add(20.0, 20.0);
    series1.add(30.0, 30.0);
    XYDataset dataset = new XYSeriesCollection(series1);
    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    XYPlot plot = (XYPlot) this.chart.getPlot();
    plot.setDataset(dataset);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around 10: " + range.getLowerBound(), range.getLowerBound() <= 10);
    assertTrue("Expecting the upper bound of the range to be around 30: " + range.getUpperBound(), range.getUpperBound() >= 30);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) XYPlot(org.jfree.chart.plot.XYPlot) ValueAxis(org.jfree.chart.axis.ValueAxis) XYDataset(org.jfree.data.xy.XYDataset) Range(org.jfree.data.Range) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection) Test(org.junit.Test)

Example 65 with ValueAxis

use of org.jfree.chart.axis.ValueAxis in project SIMVA-SoS by SESoS.

the class CombinedCategoryPlot method add.

/**
 * Adds a new subplot with the specified weight.
 *
 * @param subplot  the subplot.
 * @param weight  the weight for the subplot.
 */
public void add(CategoryPlot subplot, int weight) {
    super.add(subplot, weight);
    ValueAxis l_range = super.getRangeAxis();
    subplot.setRangeAxis(0, l_range, false);
    super.setRangeAxis(l_range);
    if (null == l_range) {
        return;
    }
    l_range.configure();
}
Also used : ValueAxis(org.jfree.chart.axis.ValueAxis)

Aggregations

ValueAxis (org.jfree.chart.axis.ValueAxis)216 XYPlot (org.jfree.chart.plot.XYPlot)77 NumberAxis (org.jfree.chart.axis.NumberAxis)50 Range (org.jfree.data.Range)40 JFreeChart (org.jfree.chart.JFreeChart)39 CategoryPlot (org.jfree.chart.plot.CategoryPlot)35 Paint (java.awt.Paint)31 CategoryAxis (org.jfree.chart.axis.CategoryAxis)30 Rectangle2D (java.awt.geom.Rectangle2D)28 CombinedDomainXYPlot (org.jfree.chart.plot.CombinedDomainXYPlot)25 Test (org.junit.Test)24 CombinedRangeXYPlot (org.jfree.chart.plot.CombinedRangeXYPlot)22 XYDataset (org.jfree.data.xy.XYDataset)22 Iterator (java.util.Iterator)20 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)18 CategoryDataset (org.jfree.data.category.CategoryDataset)17 RectangleEdge (org.jfree.ui.RectangleEdge)16 Font (java.awt.Font)14 XYSeries (org.jfree.data.xy.XYSeries)14 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)14