Search in sources :

Example 6 with DefaultPieDataset

use of org.jfree.data.pie.DefaultPieDataset in project graphcode2vec by graphcode2vec.

the class DatasetUtilities method createPieDatasetForColumn.

/**
 * Creates a pie dataset from a {@link CategoryDataset} by taking all the
 * values for a single column.
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param column  the column (zero-based index).
 *
 * @return A pie dataset.
 */
public static PieDataset createPieDatasetForColumn(CategoryDataset dataset, int column) {
    DefaultPieDataset result = new DefaultPieDataset();
    int rowCount = dataset.getRowCount();
    for (int i = 0; i < rowCount; i++) {
        Comparable rowKey = dataset.getRowKey(i);
        result.setValue(rowKey, dataset.getValue(i, column));
    }
    return result;
}
Also used : DefaultPieDataset(org.jfree.data.pie.DefaultPieDataset)

Example 7 with DefaultPieDataset

use of org.jfree.data.pie.DefaultPieDataset in project graphcode2vec by graphcode2vec.

the class PieChartDemo1 method createDataset.

/**
 * Creates a sample dataset.
 *
 * @return A sample dataset.
 */
private static PieDataset createDataset() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("One", new Double(43.2));
    dataset.setValue("Two", new Double(10.0));
    dataset.setValue("Three", new Double(27.5));
    dataset.setValue("Four", new Double(17.5));
    dataset.setValue("Five", new Double(11.0));
    dataset.setValue("Six", new Double(19.4));
    return dataset;
}
Also used : DefaultPieDataset(org.jfree.data.pie.DefaultPieDataset)

Aggregations

DefaultPieDataset (org.jfree.data.pie.DefaultPieDataset)7 Iterator (java.util.Iterator)3 List (java.util.List)3 Color (java.awt.Color)2 Font (java.awt.Font)2 StandardPieSectionLabelGenerator (org.jfree.chart.labels.StandardPieSectionLabelGenerator)2 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)2 MultiplePiePlot (org.jfree.chart.plot.MultiplePiePlot)2 PiePlot (org.jfree.chart.plot.PiePlot)2 TextTitle (org.jfree.chart.title.TextTitle)2 RectangleInsets (org.jfree.chart.util.RectangleInsets)2 ArrayList (java.util.ArrayList)1 DefaultHandler (org.xml.sax.helpers.DefaultHandler)1