Search in sources :

Example 11 with TextTitle

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)));
}
Also used : TextTitle(org.jfree.chart.title.TextTitle) NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) DefaultCategoryDataset(org.jfree.data.category.DefaultCategoryDataset) Paint(java.awt.Paint) CategoryPlot(org.jfree.chart.plot.CategoryPlot) Font(java.awt.Font)

Example 12 with TextTitle

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;
}
Also used : TextTitle(org.jfree.chart.title.TextTitle)

Aggregations

TextTitle (org.jfree.chart.title.TextTitle)12 Font (java.awt.Font)4 JFreeChart (org.jfree.chart.JFreeChart)4 Color (java.awt.Color)3 PiePlot (org.jfree.chart.plot.PiePlot)3 CommonUITool.trimPaintColor (com.cubrid.common.ui.spi.util.CommonUITool.trimPaintColor)2 BufferedImage (java.awt.image.BufferedImage)2 BigDecimal (java.math.BigDecimal)2 DecimalFormat (java.text.DecimalFormat)2 NumberFormat (java.text.NumberFormat)2 CategoryAxis (org.jfree.chart.axis.CategoryAxis)2 NumberAxis (org.jfree.chart.axis.NumberAxis)2 StandardPieSectionLabelGenerator (org.jfree.chart.labels.StandardPieSectionLabelGenerator)2 CategoryPlot (org.jfree.chart.plot.CategoryPlot)2 XYPlot (org.jfree.chart.plot.XYPlot)2 LegendTitle (org.jfree.chart.title.LegendTitle)2 DefaultCategoryDataset (org.jfree.data.category.DefaultCategoryDataset)2 DefaultPieDataset (org.jfree.data.general.DefaultPieDataset)2 GradientPaint (java.awt.GradientPaint)1 Graphics2D (java.awt.Graphics2D)1