Java Code Examples for org.jfree.chart.util.TableOrder#BY_COLUMN

The following examples show how to use org.jfree.chart.util.TableOrder#BY_COLUMN . 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: Arja_001_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 2
Source File: Arja_001_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    if (dataset != null) {
    	  setDatasetGroup(dataset.getGroup());
    	  dataset.addChangeListener(this);
    	}
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 3
Source File: Chart_12_MultiplePiePlot_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    setDataset(dataset);
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 4
Source File: Arja_00131_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 5
Source File: arja3_three_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    setDataset(dataset);
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 6
Source File: Arja_0063_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    if (dataset != null) {
    	  dataset.addChangeListener(this);
    	}
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 7
Source File: Chart_12_MultiplePiePlot_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Creates a new plot.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 */
public MultiplePiePlot(CategoryDataset dataset) {
    super();
    this.dataset = dataset;
    PiePlot piePlot = new PiePlot(null);
    this.pieChart = new JFreeChart(piePlot);
    this.pieChart.removeLegend();
    this.dataExtractOrder = TableOrder.BY_COLUMN;
    this.pieChart.setBackgroundPaint(null);
    TextTitle seriesTitle = new TextTitle("Series Title",
            new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    this.pieChart.setTitle(seriesTitle);
    this.aggregatedItemsKey = "Other";
    this.aggregatedItemsPaint = Color.lightGray;
    this.sectionPaints = new HashMap();
}
 
Example 8
Source File: 1_MultiplePiePlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Creates a new plot.
     *
     * @param dataset  the dataset (<code>null</code> permitted).
     */
    public MultiplePiePlot(CategoryDataset dataset) {
// start of generated patch
if(dataset!=null){
setDatasetGroup(dataset.getGroup());
dataset.addChangeListener(this);
}
this.dataset=dataset;
PiePlot piePlot=new PiePlot(null);
// end of generated patch
/* start of original code
        super();
        this.dataset = dataset;
        PiePlot piePlot = new PiePlot(null);
 end of original code*/
        this.pieChart = new JFreeChart(piePlot);
        this.pieChart.removeLegend();
        this.dataExtractOrder = TableOrder.BY_COLUMN;
        this.pieChart.setBackgroundPaint(null);
        TextTitle seriesTitle = new TextTitle("Series Title",
                new Font("SansSerif", Font.BOLD, 12));
        seriesTitle.setPosition(RectangleEdge.BOTTOM);
        this.pieChart.setTitle(seriesTitle);
        this.aggregatedItemsKey = "Other";
        this.aggregatedItemsPaint = Color.lightGray;
        this.sectionPaints = new HashMap();
    }
 
Example 9
Source File: 1_MultiplePiePlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Creates a new plot.
     *
     * @param dataset  the dataset (<code>null</code> permitted).
     */
    public MultiplePiePlot(CategoryDataset dataset) {
        super();
// start of generated patch
if(dataset!=null){
dataset.addChangeListener(this);
}
this.dataset=dataset;
PiePlot piePlot=new PiePlot(null);
this.pieChart=new JFreeChart(piePlot);
// end of generated patch
/* start of original code
        this.dataset = dataset;
        PiePlot piePlot = new PiePlot(null);
        this.pieChart = new JFreeChart(piePlot);
 end of original code*/
        this.pieChart.removeLegend();
        this.dataExtractOrder = TableOrder.BY_COLUMN;
        this.pieChart.setBackgroundPaint(null);
        TextTitle seriesTitle = new TextTitle("Series Title",
                new Font("SansSerif", Font.BOLD, 12));
        seriesTitle.setPosition(RectangleEdge.BOTTOM);
        this.pieChart.setTitle(seriesTitle);
        this.aggregatedItemsKey = "Other";
        this.aggregatedItemsPaint = Color.lightGray;
        this.sectionPaints = new HashMap();
    }
 
Example 10
Source File: 1_MultiplePiePlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Creates a new plot.
     *
     * @param dataset  the dataset (<code>null</code> permitted).
     */
    public MultiplePiePlot(CategoryDataset dataset) {
// start of generated patch
super();
this.dataset=dataset;
if(dataset!=null){
dataset.addChangeListener(this);
}
PiePlot piePlot=new PiePlot(null);
// end of generated patch
/* start of original code
        super();
        this.dataset = dataset;
        PiePlot piePlot = new PiePlot(null);
 end of original code*/
        this.pieChart = new JFreeChart(piePlot);
        this.pieChart.removeLegend();
        this.dataExtractOrder = TableOrder.BY_COLUMN;
        this.pieChart.setBackgroundPaint(null);
        TextTitle seriesTitle = new TextTitle("Series Title",
                new Font("SansSerif", Font.BOLD, 12));
        seriesTitle.setPosition(RectangleEdge.BOTTOM);
        this.pieChart.setTitle(seriesTitle);
        this.aggregatedItemsKey = "Other";
        this.aggregatedItemsPaint = Color.lightGray;
        this.sectionPaints = new HashMap();
    }
 
Example 11
Source File: Arja_0063_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 12
Source File: Arja_00131_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 13
Source File: Arja_001_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 14
Source File: arja3_three_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 15
Source File: Arja_00162_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 16
Source File: Arja_0090_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 17
Source File: Chart_12_MultiplePiePlot_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 18
Source File: 1_MultiplePiePlot.java    From SimFix with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 19
Source File: Arja_00131_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}
 
Example 20
Source File: Arja_00148_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Returns a collection of legend items for the pie chart.
 *
 * @return The legend items.
 */
public LegendItemCollection getLegendItems() {

    LegendItemCollection result = new LegendItemCollection();

    if (this.dataset != null) {
        List keys = null;

        prefetchSectionPaints();
        if (this.dataExtractOrder == TableOrder.BY_ROW) {
            keys = this.dataset.getColumnKeys();
        }
        else if (this.dataExtractOrder == TableOrder.BY_COLUMN) {
            keys = this.dataset.getRowKeys();
        }

        if (keys != null) {
            int section = 0;
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                Comparable key = (Comparable) iterator.next();
                String label = key.toString();
                String description = label;
                Paint paint = (Paint) this.sectionPaints.get(key);
                LegendItem item = new LegendItem(label, description,
                        null, null, Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                        paint, Plot.DEFAULT_OUTLINE_STROKE, paint);
                item.setDataset(getDataset());
                result.add(item);
                section++;
            }
        }
        if (this.limit > 0.0) {
            result.add(new LegendItem(this.aggregatedItemsKey.toString(),
                    this.aggregatedItemsKey.toString(), null, null,
                    Plot.DEFAULT_LEGEND_ITEM_CIRCLE,
                    this.aggregatedItemsPaint,
                    Plot.DEFAULT_OUTLINE_STROKE,
                    this.aggregatedItemsPaint));
        }
    }
    return result;
}