use of org.jfree.chart.title.TextTitle in project bamboobsc by billchen198318.
the class CommonBarChartAction method fillChart.
private void fillChart(String title, String categoryLabel, String valueLabel, List<String> names, List<Float> values, List<String> colors, boolean horizontal) throws Exception {
DefaultCategoryDataset data = new DefaultCategoryDataset();
for (int ix = 0; ix < names.size(); ix++) {
data.addValue(values.get(ix), "", names.get(ix));
}
this.chart = ChartFactory.createBarChart3D(// title
title, categoryLabel, valueLabel, data, (horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL), false, false, false);
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
CategoryAxis categoryAxis = plot.getDomainAxis();
categoryAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
categoryAxis.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();
numberAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
this.setPlotColor(plot, names, colors);
this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9)));
}
use of org.jfree.chart.title.TextTitle in project dhis2-core by dhis2.
the class DefaultChartService method getSubTitle.
private TextTitle getSubTitle(BaseChart chart) {
TextTitle textTitle = new TextTitle();
String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
textTitle.setFont(SUB_TITLE_FONT);
textTitle.setText(title);
return textTitle;
}
Aggregations