Example usage for org.jfree.chart StandardChartTheme getAxisLabelPaint

List of usage examples for org.jfree.chart StandardChartTheme getAxisLabelPaint

Introduction

In this page you can find the example usage for org.jfree.chart StandardChartTheme getAxisLabelPaint.

Prototype

public Paint getAxisLabelPaint() 

Source Link

Document

Returns the axis label paint.

Usage

From source file:edu.gmu.cs.sim.util.media.chart.PieChartGenerator.java

protected void buildChart() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    chart = ChartFactory.createMultiplePieChart("Untitled Chart", dataset, org.jfree.util.TableOrder.BY_COLUMN,
            false, true, false);/*w ww  .j  a  v a  2s.c  om*/
    chart.setAntiAlias(true);
    //chartPanel = new ScrollableChartPanel(chart, true);            
    chartPanel = buildChartPanel(chart);
    //chartHolder.getViewport().setView(chartPanel);
    setChartPanel(chartPanel);

    JFreeChart baseChart = (JFreeChart) ((MultiplePiePlot) (chart.getPlot())).getPieChart();
    PiePlot base = (PiePlot) (baseChart.getPlot());
    base.setIgnoreZeroValues(true);
    base.setLabelOutlinePaint(java.awt.Color.WHITE);
    base.setLabelShadowPaint(java.awt.Color.WHITE);
    base.setMaximumLabelWidth(0.25); // allow bigger labels by a bit (this will make the chart smaller)
    base.setInteriorGap(0.000); // allow stretch to compensate for the bigger label width
    base.setLabelBackgroundPaint(java.awt.Color.WHITE);
    base.setOutlinePaint(null);
    base.setBackgroundPaint(null);
    base.setShadowPaint(null);
    base.setSimpleLabels(false); // I think they're false anyway

    // change the look of the series title to be smaller
    StandardChartTheme theme = new StandardChartTheme("Hi");
    TextTitle title = new TextTitle("Whatever", theme.getLargeFont());
    title.setPaint(theme.getAxisLabelPaint());
    title.setPosition(RectangleEdge.BOTTOM);
    baseChart.setTitle(title);

    // this must come last because the chart must exist for us to set its dataset
    setSeriesDataset(dataset);
}