use of org.krysalis.jcharts.properties.util.ChartFont in project activityinfo by bedatadriven.
the class ChartRendererJC method computeAxisProperties.
protected AxisProperties computeAxisProperties(int dpi, PivotChartContent content) throws PropertyException {
ChartFont axisScaleFont = new ChartFont(new Font(SANS_SERIF, Font.PLAIN, fontSize(10, dpi)), Color.black);
ChartFont axisTitleFont = new ChartFont(new Font(SANS_SERIF, Font.PLAIN, fontSize(11, dpi)), Color.black);
AxisProperties p = new AxisProperties(false);
LabelAxisProperties x = (LabelAxisProperties) p.getXAxisProperties();
x.setScaleChartFont(axisScaleFont);
x.setAxisTitleChartFont(axisTitleFont);
DataAxisProperties y = (DataAxisProperties) p.getYAxisProperties();
y.setScaleChartFont(axisScaleFont);
y.setUserDefinedScale(content.getYMin(), content.getYStep());
y.setAxisTitleChartFont(axisTitleFont);
y.setShowGridLines(1);
return p;
}
use of org.krysalis.jcharts.properties.util.ChartFont in project activityinfo by bedatadriven.
the class ChartRendererJC method computeLegendProperties.
protected LegendProperties computeLegendProperties(PivotChartReportElement element, int dpi, List<PivotTableData.Axis> series) {
// if there is only series, there is no need for a legend
if (series.size() <= 1) {
return null;
}
ChartFont font = new ChartFont(new Font(SANS_SERIF, Font.PLAIN, fontSize(10, dpi)), Color.BLACK);
LegendProperties p = new LegendProperties();
p.setChartFont(font);
p.setBorderStroke(null);
p.setIconBorderPaint(null);
if (element.getType() == Type.Pie) {
p.setPlacement(LegendProperties.RIGHT);
} else {
p.setPlacement(maxLegendTextLength(series) > 30 ? LegendProperties.BOTTOM : LegendProperties.RIGHT);
}
p.setNumColumns(1);
return p;
}
use of org.krysalis.jcharts.properties.util.ChartFont 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);
}
use of org.krysalis.jcharts.properties.util.ChartFont in project activityinfo by bedatadriven.
the class ChartRendererJC method computeChartProperties.
protected ChartProperties computeChartProperties(int dpi) {
ChartProperties p = new ChartProperties();
ChartFont titleFont = new ChartFont(new Font(SANS_SERIF, Font.PLAIN, fontSize(12, dpi)), Color.black);
p.setTitleFont(titleFont);
return p;
}
Aggregations