Example usage for org.jfree.chart ChartFactory setChartTheme

List of usage examples for org.jfree.chart ChartFactory setChartTheme

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory setChartTheme.

Prototype

public static void setChartTheme(ChartTheme theme) 

Source Link

Document

Sets the current chart theme.

Usage

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java

protected JFreeChart createBubbleChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createBubbleChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRBubblePlot) getPlot()).getXAxisLabelExpression()),
            evaluateTextExpression(((JRBubblePlot) getPlot()).getYAxisLabelExpression()),
            (XYZDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(), true,
            false);//from   w  w  w.  ja  v a  2  s. c  om

    configureChart(jfreeChart);

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRBubblePlot bubblePlot = (JRBubblePlot) getPlot();
    int scaleType = bubblePlot.getScaleTypeValue() == null ? ScaleTypeEnum.ON_RANGE_AXIS.getValue()
            : bubblePlot.getScaleTypeValue().getValue();
    XYBubbleRenderer bubbleRenderer = new XYBubbleRenderer(scaleType);
    xyPlot.setRenderer(bubbleRenderer);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), bubblePlot.getXAxisLabelFont(), bubblePlot.getXAxisLabelColor(),
            bubblePlot.getXAxisTickLabelFont(), bubblePlot.getXAxisTickLabelColor(),
            bubblePlot.getXAxisTickLabelMask(), bubblePlot.getXAxisVerticalTickLabels(),
            bubblePlot.getXAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(bubblePlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bubblePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), bubblePlot.getYAxisLabelFont(), bubblePlot.getYAxisLabelColor(),
            bubblePlot.getYAxisTickLabelFont(), bubblePlot.getYAxisTickLabelColor(),
            bubblePlot.getYAxisTickLabelMask(), bubblePlot.getYAxisVerticalTickLabels(),
            bubblePlot.getYAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(bubblePlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bubblePlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

/**
 *
 *//*from  ww w . j a  va2 s . c o  m*/
protected JFreeChart createHighLowChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createHighLowChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRHighLowPlot) getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRHighLowPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart, getPlot());
    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot) getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false
            : highLowPlot.getShowCloseTicks();

    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
            highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
            highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(),
            highLowPlot.getTimeAxisVerticalTickLabels(), highLowPlot.getOwnTimeAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable<?>) evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
            highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
            highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(),
            highLowPlot.getValueAxisVerticalTickLabels(), highLowPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable<?>) evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createLineChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart freeChart = ChartFactory.createLineChart(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRLinePlot) getPlot()).getCategoryAxisLabelExpression()),
            (String) evaluateExpression(((JRLinePlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(freeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) freeChart.getPlot();
    JRLinePlot linePlot = (JRLinePlot) getPlot();

    LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer) categoryPlot.getRenderer();
    boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes().booleanValue();
    boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines().booleanValue();

    lineRenderer.setBaseShapesVisible(isShowShapes);//FIXMECHART check this
    lineRenderer.setBaseLinesVisible(isShowLines);

    //FIXME labels?

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
            linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
            linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(),
            linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getOwnCategoryAxisLineColor(),
            getDomainAxisSettings(),/*from   ww w.  j a  v a 2 s . co m*/
            (Comparable) evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
            linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
            linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(),
            linePlot.getValueAxisVerticalTickLabels(), linePlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(), (Comparable) evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));

    return freeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java

protected JFreeChart createLineChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart freeChart = ChartFactory.createLineChart(evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRLinePlot) getPlot()).getCategoryAxisLabelExpression()),
            evaluateTextExpression(((JRLinePlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(),
            true, false);/*from w  ww  .  ja v  a2  s .com*/

    configureChart(freeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) freeChart.getPlot();
    JRLinePlot linePlot = (JRLinePlot) getPlot();

    LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer) categoryPlot.getRenderer();
    boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes();
    boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines();

    lineRenderer.setBaseShapesVisible(isShowShapes);//FIXMECHART check this
    lineRenderer.setBaseLinesVisible(isShowLines);

    //FIXME labels?

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
            linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
            linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(),
            linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getOwnCategoryAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
            linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
            linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(),
            linePlot.getValueAxisVerticalTickLabels(), linePlot.getOwnValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));

    return freeChart;
}

From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java

/**
 *
 *//*w ww .  j  a  va2 s. c  om*/
protected JFreeChart createPie3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart3D(
            (String) evaluateExpression(getChart().getTitleExpression()), (PieDataset) getDataset(),
            isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPie3DPlot jrPlot = (JRPie3DPlot) getPlot();
    double depthFactor = jrPlot.getDepthFactorDouble() == null ? JRPie3DPlot.DEPTH_FACTOR_DEFAULT
            : jrPlot.getDepthFactorDouble().doubleValue();
    boolean isCircular = jrPlot.getCircular() == null ? false : jrPlot.getCircular().booleanValue();
    piePlot3D.setDepthFactor(depthFactor);
    piePlot3D.setCircular(isCircular);

    PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
    JRItemLabel itemLabel = jrPlot.getItemLabel();
    if (labelGenerator != null) {
        piePlot3D.setLabelGenerator(labelGenerator);
    } else if (jrPlot.getLabelFormat() != null) {
        piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPlot.getLabelFormat()));
    }
    //      else if (itemLabel != null && itemLabel.getMask() != null)
    //      {
    //         piePlot3D.setLabelGenerator(
    //            new StandardPieSectionLabelGenerator(itemLabel.getMask())
    //            );
    //      }
    else {
        piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator());
    }

    if (jrPlot.getLegendLabelFormat() != null) {
        piePlot3D.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(jrPlot.getLegendLabelFormat()));
    }

    Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
            ChartThemesConstants.BASEFONT_SIZE);
    JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;
    piePlot3D.setLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));

    if (itemLabel != null && itemLabel.getColor() != null) {
        piePlot3D.setLabelPaint(itemLabel.getColor());
    } else {
        piePlot3D.setLabelPaint(getChart().getForecolor());
    }

    if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
        piePlot3D.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
    } else {
        piePlot3D.setLabelBackgroundPaint(getChart().getBackcolor());
    }

    return jfreeChart;
}

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java

/**
 *
 *///  w  w  w.  j  av  a 2  s  .co m
protected JFreeChart createCandlestickChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createCandlestickChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRCandlestickPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart);

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRCandlestickPlot candlestickPlot = (JRCandlestickPlot) getPlot();
    CandlestickRenderer candlestickRenderer = (CandlestickRenderer) xyPlot.getRenderer();
    boolean isShowVolume = candlestickPlot.getShowVolume() == null ? true : candlestickPlot.getShowVolume();
    candlestickRenderer.setDrawVolume(isShowVolume);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), candlestickPlot.getTimeAxisLabelFont(),
            candlestickPlot.getTimeAxisLabelColor(), candlestickPlot.getTimeAxisTickLabelFont(),
            candlestickPlot.getTimeAxisTickLabelColor(), candlestickPlot.getTimeAxisTickLabelMask(),
            candlestickPlot.getTimeAxisVerticalTickLabels(), candlestickPlot.getTimeAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), candlestickPlot.getValueAxisLabelFont(),
            candlestickPlot.getValueAxisLabelColor(), candlestickPlot.getValueAxisTickLabelFont(),
            candlestickPlot.getValueAxisTickLabelColor(), candlestickPlot.getValueAxisTickLabelMask(),
            candlestickPlot.getValueAxisVerticalTickLabels(), candlestickPlot.getValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(candlestickPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createLineChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart freeChart = ChartFactory.createLineChart(evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRLinePlot) getPlot()).getCategoryAxisLabelExpression()),
            evaluateTextExpression(((JRLinePlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(),
            true, false);//from  w  ww  . j a  v  a  2  s .c  o  m

    configureChart(freeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) freeChart.getPlot();
    JRLinePlot linePlot = (JRLinePlot) getPlot();

    LineAndShapeRenderer lineRenderer = (LineAndShapeRenderer) categoryPlot.getRenderer();
    boolean isShowShapes = linePlot.getShowShapes() == null ? true : linePlot.getShowShapes();
    boolean isShowLines = linePlot.getShowLines() == null ? true : linePlot.getShowLines();

    lineRenderer.setBaseShapesVisible(isShowShapes);//FIXMECHART check this
    lineRenderer.setBaseLinesVisible(isShowLines);

    //FIXME labels?

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), linePlot.getCategoryAxisLabelFont(),
            linePlot.getCategoryAxisLabelColor(), linePlot.getCategoryAxisTickLabelFont(),
            linePlot.getCategoryAxisTickLabelColor(), linePlot.getCategoryAxisTickLabelMask(),
            linePlot.getCategoryAxisVerticalTickLabels(), linePlot.getOwnCategoryAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable<?>) evaluateExpression(linePlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(linePlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), linePlot.getValueAxisLabelFont(),
            linePlot.getValueAxisLabelColor(), linePlot.getValueAxisTickLabelFont(),
            linePlot.getValueAxisTickLabelColor(), linePlot.getValueAxisTickLabelMask(),
            linePlot.getValueAxisVerticalTickLabels(), linePlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable<?>) evaluateExpression(linePlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(linePlot.getRangeAxisMaxValueExpression()));

    return freeChart;
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

/**
 *
 */// w w  w .  j a  v a 2s.  c  o m
protected JFreeChart createPie3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart3D(
            (String) evaluateExpression(getChart().getTitleExpression()), (PieDataset) getDataset(),
            isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPie3DPlot jrPlot = (JRPie3DPlot) getPlot();
    double depthFactor = jrPlot.getDepthFactorDouble() == null ? JRPie3DPlot.DEPTH_FACTOR_DEFAULT
            : jrPlot.getDepthFactorDouble().doubleValue();
    boolean isCircular = jrPlot.getCircular() == null ? false : jrPlot.getCircular().booleanValue();
    piePlot3D.setDepthFactor(depthFactor);
    piePlot3D.setCircular(isCircular);

    PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
    JRItemLabel itemLabel = jrPlot.getItemLabel();
    if (labelGenerator != null) {
        piePlot3D.setLabelGenerator(labelGenerator);
    } else if (jrPlot.getLabelFormat() != null) {
        piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPlot.getLabelFormat()));
    }
    //      else if (itemLabel != null && itemLabel.getMask() != null)
    //      {
    //         piePlot3D.setLabelGenerator(
    //               new StandardPieSectionLabelGenerator(itemLabel.getMask())
    //               );
    //      }

    if (jrPlot.getLegendLabelFormat() != null) {
        piePlot3D.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(jrPlot.getLegendLabelFormat()));
    }

    if (itemLabel != null && itemLabel.getFont() != null) {
        piePlot3D.setLabelFont(JRFontUtil.getAwtFont(itemLabel.getFont(), getLocale()));
    } else {
        piePlot3D.setLabelFont(JRFontUtil.getAwtFont(new JRBaseFont(getChart(), null), getLocale()));
    }

    if (itemLabel != null && itemLabel.getColor() != null) {
        piePlot3D.setLabelPaint(itemLabel.getColor());
    } else {
        piePlot3D.setLabelPaint(getChart().getForecolor());
    }

    if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
        piePlot3D.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
    } else {
        piePlot3D.setLabelBackgroundPaint(getChart().getBackcolor());
    }

    return jfreeChart;
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java

/**
 *
 *///from w  ww.  ja v  a 2s.  c  o  m
protected JFreeChart createPie3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createPieChart3D(
            evaluateTextExpression(getChart().getTitleExpression()), (PieDataset) getDataset(), isShowLegend(),
            true, false);

    configureChart(jfreeChart, getPlot());

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    //plot.setStartAngle(290);
    //plot.setDirection(Rotation.CLOCKWISE);
    //plot.setNoDataMessage("No data to display");
    JRPie3DPlot jrPie3DPlot = (JRPie3DPlot) getPlot();
    double depthFactor = jrPie3DPlot.getDepthFactorDouble() == null ? JRPie3DPlot.DEPTH_FACTOR_DEFAULT
            : jrPie3DPlot.getDepthFactorDouble();
    boolean isCircular = jrPie3DPlot.getCircular() == null ? false : jrPie3DPlot.getCircular();
    piePlot3D.setDepthFactor(depthFactor);
    piePlot3D.setCircular(isCircular);

    boolean isShowLabels = jrPie3DPlot.getShowLabels() == null ? true : jrPie3DPlot.getShowLabels();

    if (isShowLabels) {
        PieSectionLabelGenerator labelGenerator = (PieSectionLabelGenerator) getLabelGenerator();
        JRItemLabel itemLabel = jrPie3DPlot.getItemLabel();
        if (labelGenerator != null) {
            piePlot3D.setLabelGenerator(labelGenerator);
        } else if (jrPie3DPlot.getLabelFormat() != null) {
            piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator(jrPie3DPlot.getLabelFormat(),
                    NumberFormat.getNumberInstance(getLocale()), NumberFormat.getPercentInstance(getLocale())));
        }
        //      else if (itemLabel != null && itemLabel.getMask() != null)
        //      {
        //         piePlot3D.setLabelGenerator(
        //            new StandardPieSectionLabelGenerator(itemLabel.getMask())
        //            );
        //      }
        else {
            piePlot3D.setLabelGenerator(new StandardPieSectionLabelGenerator());
        }

        Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
                ChartThemesConstants.BASEFONT_SIZE);
        JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;
        piePlot3D.setLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));

        if (itemLabel != null && itemLabel.getColor() != null) {
            piePlot3D.setLabelPaint(itemLabel.getColor());
        } else {
            piePlot3D.setLabelPaint(getChart().getForecolor());
        }

        if (itemLabel != null && itemLabel.getBackgroundColor() != null) {
            piePlot3D.setLabelBackgroundPaint(itemLabel.getBackgroundColor());
        } else {
            piePlot3D.setLabelBackgroundPaint(getChart().getBackcolor());
        }
    } else {
        piePlot3D.setLabelGenerator(null);
    }

    if (jrPie3DPlot.getLegendLabelFormat() != null) {
        piePlot3D.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(
                jrPie3DPlot.getLegendLabelFormat(), NumberFormat.getNumberInstance(getLocale()),
                NumberFormat.getPercentInstance(getLocale())));
    }

    return jfreeChart;
}

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java

/**
 *
 *//*from   w w w  .  ja v  a 2  s.c  om*/
protected JFreeChart createHighLowChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createHighLowChart(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRHighLowPlot) getPlot()).getTimeAxisLabelExpression()),
            evaluateTextExpression(((JRHighLowPlot) getPlot()).getValueAxisLabelExpression()),
            (DefaultHighLowDataset) getDataset(), isShowLegend());

    configureChart(jfreeChart);

    XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
    JRHighLowPlot highLowPlot = (JRHighLowPlot) getPlot();
    HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
    boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks();
    boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false
            : highLowPlot.getShowCloseTicks();

    hlRenderer.setDrawOpenTicks(isShowOpenTicks);
    hlRenderer.setDrawCloseTicks(isShowCloseTicks);

    // Handle the axis formating for the category axis
    configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
            highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
            highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(),
            highLowPlot.getTimeAxisVerticalTickLabels(), highLowPlot.getTimeAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
            highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
            highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(),
            highLowPlot.getValueAxisVerticalTickLabels(), highLowPlot.getValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}