Java Code Examples for org.jfree.chart.plot.XYPlot#getLegendItems()

The following examples show how to use org.jfree.chart.plot.XYPlot#getLegendItems() . 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: XYPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getLegendItems() method.
 */
public void testGetLegendItems() {
    // check the case where there is a secondary dataset that doesn't
    // have a renderer (i.e. falls back to renderer 0)
    XYDataset d0 = createDataset1();
    XYDataset d1 = createDataset2();
    XYItemRenderer r0 = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot();
    plot.setDataset(0, d0);
    plot.setDataset(1, d1);
    plot.setRenderer(0, r0);
    LegendItemCollection items = plot.getLegendItems();
    assertEquals(2, items.getItemCount());
}
 
Example 2
Source File: XYPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the getLegendItems() method.
 */
public void testGetLegendItems() {
    // check the case where there is a secondary dataset that doesn't 
    // have a renderer (i.e. falls back to renderer 0)
    XYDataset d0 = createDataset1();
    XYDataset d1 = createDataset2();
    XYItemRenderer r0 = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot();
    plot.setDataset(0, d0);
    plot.setDataset(1, d1);
    plot.setRenderer(0, r0);
    LegendItemCollection items = plot.getLegendItems();
    assertEquals(2, items.getItemCount());
}