org.jfree.chart.plot.CombinedDomainCategoryPlot Java Examples

The following examples show how to use org.jfree.chart.plot.CombinedDomainCategoryPlot. 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: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check that only one chart change event is generated by a change to a
 * subplot.
 */
public void testNotification() {
    CombinedDomainCategoryPlot plot = createPlot();
    JFreeChart chart = new JFreeChart(plot);
    chart.addChangeListener(this);
    CategoryPlot subplot1 = (CategoryPlot) plot.getSubplots().get(0);
    NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();
    yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());
    assertEquals(1, this.events.size());

    // a redraw should NOT trigger another change event
    BufferedImage image = new BufferedImage(200, 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    this.events.clear();
    chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));
    assertTrue(this.events.isEmpty());
}
 
Example #2
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This is a test to replicate the bug report 987080.
 */
public void testRemoveSubplot() {
    CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot();
    CategoryPlot plot1 = new CategoryPlot();
    CategoryPlot plot2 = new CategoryPlot();
    plot.add(plot1);
    plot.add(plot2);
    // remove plot2, but plot1 is removed instead
    plot.remove(plot2);
    List plots = plot.getSubplots();
    assertTrue(plots.get(0) == plot1);
    assertEquals(1, plots.size());
}
 
Example #3
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a sample plot.
 *
 * @return A sample plot.
 */
private CombinedDomainCategoryPlot createPlot() {

    CategoryDataset dataset1 = createDataset1();
    NumberAxis rangeAxis1 = new NumberAxis("Value");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
    renderer1.setBaseToolTipGenerator(
        new StandardCategoryToolTipGenerator()
    );
    CategoryPlot subplot1 = new CategoryPlot(
        dataset1, null, rangeAxis1, renderer1
    );
    subplot1.setDomainGridlinesVisible(true);

    CategoryDataset dataset2 = createDataset2();
    NumberAxis rangeAxis2 = new NumberAxis("Value");
    rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer2 = new BarRenderer();
    renderer2.setBaseToolTipGenerator(
        new StandardCategoryToolTipGenerator()
    );
    CategoryPlot subplot2 = new CategoryPlot(
        dataset2, null, rangeAxis2, renderer2
    );
    subplot2.setDomainGridlinesVisible(true);

    CategoryAxis domainAxis = new CategoryAxis("Category");
    CombinedDomainCategoryPlot plot
        = new CombinedDomainCategoryPlot(domainAxis);
    plot.add(subplot1, 2);
    plot.add(subplot2, 1);
    return plot;

}
 
Example #4
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This is a test to replicate the bug report 987080.
 */
public void testRemoveSubplot() {
    CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot();
    CategoryPlot plot1 = new CategoryPlot();
    CategoryPlot plot2 = new CategoryPlot();
    plot.add(plot1);
    plot.add(plot2);
    // remove plot2, but plot1 is removed instead
    plot.remove(plot2);
    List plots = plot.getSubplots();
    assertTrue(plots.get(0) == plot1);
    assertEquals(1, plots.size());
}
 
Example #5
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a sample plot.
 * 
 * @return A sample plot.
 */
private CombinedDomainCategoryPlot createPlot() {
    
    CategoryDataset dataset1 = createDataset1();
    NumberAxis rangeAxis1 = new NumberAxis("Value");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    LineAndShapeRenderer renderer1 = new LineAndShapeRenderer();
    renderer1.setBaseToolTipGenerator(
        new StandardCategoryToolTipGenerator()
    );
    CategoryPlot subplot1 = new CategoryPlot(
        dataset1, null, rangeAxis1, renderer1
    );
    subplot1.setDomainGridlinesVisible(true);
    
    CategoryDataset dataset2 = createDataset2();
    NumberAxis rangeAxis2 = new NumberAxis("Value");
    rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    BarRenderer renderer2 = new BarRenderer();
    renderer2.setBaseToolTipGenerator(
        new StandardCategoryToolTipGenerator()
    );
    CategoryPlot subplot2 = new CategoryPlot(
        dataset2, null, rangeAxis2, renderer2
    );
    subplot2.setDomainGridlinesVisible(true);

    CategoryAxis domainAxis = new CategoryAxis("Category");
    CombinedDomainCategoryPlot plot 
        = new CombinedDomainCategoryPlot(domainAxis);
    plot.add(subplot1, 2);
    plot.add(subplot2, 1);
    return plot;
    
}
 
Example #6
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    CombinedDomainCategoryPlot plot1 = createPlot();
    CombinedDomainCategoryPlot plot2 = createPlot();
    assertTrue(plot1.equals(plot2));
}
 
Example #7
Source File: CombinedDomainCategoryPlotTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the equals() method.
 */
public void testEquals() {
    CombinedDomainCategoryPlot plot1 = createPlot();
    CombinedDomainCategoryPlot plot2 = createPlot();
    assertTrue(plot1.equals(plot2));    
}