Search in sources :

Example 1 with PieChartDataSet

use of org.krysalis.jcharts.chartData.PieChartDataSet in project activityinfo by bedatadriven.

the class ChartRendererJC method createPieChart.

/**
 * Creates a JChart PieChart from our report element
 */
protected Chart createPieChart(PivotChartReportElement element, boolean includeTitle, int width, int height, int dpi) throws IOException, ChartDataException {
    PivotTableData table = element.getContent().getData();
    List<PivotTableData.Axis> categories = table.getRootCategory().getLeaves();
    PivotTableData.Axis series = table.getRootSeries().getLeaves().get(0);
    PieChart2DProperties pieProps = new PieChart2DProperties();
    pieProps.setValueLabelFont(new ChartFont(new Font(SANS_SERIF, Font.PLAIN, fontSize(10, dpi)), Color.black));
    pieProps.setShowGrouping(true);
    pieProps.setPieLabelType(PieLabelType.VALUE_LABELS);
    pieProps.setBorderChartStroke(ChartStroke.DEFAULT_ZERO_LINE);
    PieChartDataSet dataSet = new PieChartDataSet(includeTitle ? element.getTitle() : null, toDataArray(categories, series), toLabelArray(element.getContent(), categories), computePaints(categories), pieProps);
    LegendProperties legendProps = computeLegendProperties(element, dpi, categories);
    ChartProperties chartProps = computeChartProperties(dpi);
    return new PieChart2D(dataSet, legendProps, chartProps, width, height);
}
Also used : ChartFont(org.krysalis.jcharts.properties.util.ChartFont) PieChartDataSet(org.krysalis.jcharts.chartData.PieChartDataSet) PivotTableData(org.activityinfo.legacy.shared.reports.content.PivotTableData) PieChart2D(org.krysalis.jcharts.nonAxisChart.PieChart2D) ChartFont(org.krysalis.jcharts.properties.util.ChartFont)

Aggregations

PivotTableData (org.activityinfo.legacy.shared.reports.content.PivotTableData)1 PieChartDataSet (org.krysalis.jcharts.chartData.PieChartDataSet)1 PieChart2D (org.krysalis.jcharts.nonAxisChart.PieChart2D)1 ChartFont (org.krysalis.jcharts.properties.util.ChartFont)1