Example usage for org.jfree.chart.plot PiePlot3D setDarkerSides

List of usage examples for org.jfree.chart.plot PiePlot3D setDarkerSides

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot3D setDarkerSides.

Prototype

public void setDarkerSides(boolean darker) 

Source Link

Document

Sets a flag that controls whether or not the sides of the pie chart are rendered using a darker colour, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.eastwood.ChartEngine.java

/**
 * Creates a pie chart with 3D effect.//from   w ww. j  a  v  a2s.co  m
 *
 * @return A pie chart.
 */
private static JFreeChart createPieChart3D() {
    JFreeChart chart = ChartFactory.createPieChart3D(null, null, false, true, false);
    chart.setBackgroundPaint(Color.white);
    chart.setBorderPaint(Color.white);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setDarkerSides(true);
    plot.setBaseSectionOutlinePaint(new Color(0, 0, 0, 0));
    plot.setStartAngle(0.0);
    plot.setInteriorGap(0.10);
    plot.setLabelGenerator(null);
    plot.setOutlineVisible(false);
    plot.setLabelBackgroundPaint(Color.white);
    plot.setLabelOutlinePaint(null);
    plot.setLabelShadowPaint(null);
    plot.setLabelPadding(RectangleInsets.ZERO_INSETS);
    plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12));
    plot.setLabelPaint(Color.darkGray);
    plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}"));
    return chart;
}

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

/**
 *
 *//*  w  w w  . j  a va 2s  . com*/
protected JFreeChart createPie3DChart() throws JRException {
    JFreeChart jfreeChart = super.createPie3DChart();

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setDarkerSides(true);
    piePlot3D.setDepthFactor(0.07);
    //does not work for 3D
    //      piePlot3D.setShadowXOffset(5);
    //      piePlot3D.setShadowYOffset(10);
    //      piePlot3D.setShadowPaint(new GradientPaint(
    //            0,
    //            getChart().getHeight() / 2,
    //            new Color(41, 120, 162),
    //            0,
    //            getChart().getHeight(),
    //            Color.white)
    //      );

    PieDataset pieDataset = piePlot3D.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
        }
    }
    piePlot3D.setCircular(true);
    return jfreeChart;
}

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

@Override
protected JFreeChart createPie3DChart() throws JRException {
    JFreeChart jfreeChart = super.createPie3DChart();

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    JRPie3DPlot jrPiePlot = (JRPie3DPlot) getPlot();
    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();
    if (isShowLabels && piePlot3D.getLabelGenerator() != null) {
        piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    }//w  w  w  . j a va 2s.co  m
    piePlot3D.setDarkerSides(true);
    piePlot3D.setDepthFactor(0.07);
    //does not work for 3D
    //      piePlot3D.setShadowXOffset(5);
    //      piePlot3D.setShadowYOffset(10);
    //      piePlot3D.setShadowPaint(new GradientPaint(
    //            0,
    //            getChart().getHeight() / 2,
    //            new Color(41, 120, 162),
    //            0,
    //            getChart().getHeight(),
    //            Color.white)
    //      );

    PieDataset pieDataset = piePlot3D.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
        }
    }
    piePlot3D.setCircular(true);
    return jfreeChart;
}

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

/**
 *
 *//* w  ww  . ja  v a 2s .  c o m*/
protected JFreeChart createPie3DChart() throws JRException {
    JFreeChart jfreeChart = super.createPie3DChart();

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot3D.setDarkerSides(true);
    piePlot3D.setDepthFactor(0.1);
    // does not work for 3D
    //      piePlot3D.setShadowXOffset(5);
    //      piePlot3D.setShadowYOffset(10);
    //      piePlot3D.setShadowPaint(new GradientPaint(
    //            0,
    //            getChart().getHeight() / 2,
    //            new Color(41, 120, 162),
    //            0,
    //            getChart().getHeight(),
    //            Color.white)
    //      );

    PieDataset pieDataset = piePlot3D.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
        }
    }

    piePlot3D.setCircular(true);
    return jfreeChart;
}

From source file:org.sonar.plugins.abacus.chart.PieChart3D.java

@Override
protected Plot getPlot(ChartParameters params) {
    PiePlot3D plot = new PiePlot3D();

    String[] colorsHex = params.getValues(PARAM_COLORS, ",", true);
    String[] serie = params.getValues(PARAM_VALUES, ";", true);

    DefaultPieDataset set = new DefaultPieDataset();

    Color[] colors = COLORS;/*from w w  w . j a  v a2  s .co m*/
    if (colorsHex != null && colorsHex.length > 0) {
        colors = new Color[colorsHex.length];
        for (int i = 0; i < colorsHex.length; i++) {
            colors[i] = Color.decode("#" + colorsHex[i]);
        }
    }

    String[] keyValue = null;
    for (int i = 0; i < serie.length; i++) {
        if (!StringUtils.isEmpty(serie[i])) {
            keyValue = StringUtils.split(serie[i], "=");
            set.setValue(keyValue[0], Double.parseDouble(keyValue[1]));
            plot.setSectionPaint(keyValue[0], colors[i]);
        }
    }
    plot.setDataset(set);

    plot.setStartAngle(360);
    plot.setCircular(true);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setForegroundAlpha(1.0f);
    plot.setBackgroundAlpha(0.0f);
    plot.setIgnoreNullValues(true);
    plot.setIgnoreZeroValues(true);
    plot.setOutlinePaint(Color.WHITE);
    plot.setShadowPaint(Color.WHITE);
    plot.setDarkerSides(false);
    plot.setLabelFont(DEFAULT_FONT);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(Color.WHITE);
    plot.setLabelOutlinePaint(Color.WHITE);
    plot.setLabelShadowPaint(Color.WHITE);
    plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1));
    plot.setInteriorGap(0.02);
    plot.setMaximumLabelWidth(0.15);

    return plot;
}

From source file:org.sonar.plugins.scmstats.charts.PieChart3D.java

@Override
protected Plot getPlot(ChartParameters params) {
    PiePlot3D plot = new PiePlot3D();

    String[] colorsHex = params.getValues(PARAM_COLORS, ",", true);
    String[] serie = params.getValues(PARAM_VALUES, ";", true);

    DefaultPieDataset set = new DefaultPieDataset();

    Color[] colors = COLORS;//from w  ww . j av  a2  s .c  om
    if (colorsHex != null && colorsHex.length > 0) {
        colors = new Color[colorsHex.length];
        for (int i = 0; i < colorsHex.length; i++) {
            colors[i] = Color.decode("#" + colorsHex[i]);
        }
    }

    String[] keyValue = null;
    for (int i = 0; i < serie.length; i++) {
        if (!StringUtils.isEmpty(serie[i])) {
            keyValue = StringUtils.split(serie[i], "=");
            set.setValue(keyValue[0], Double.parseDouble(keyValue[1]));
            plot.setSectionPaint(keyValue[0], colors[i]);
        }
    }
    plot.setDataset(set);

    plot.setStartAngle(180);
    plot.setCircular(true);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setForegroundAlpha(1.0f);
    plot.setBackgroundAlpha(0.0f);
    plot.setIgnoreNullValues(true);
    plot.setIgnoreZeroValues(true);
    plot.setOutlinePaint(Color.WHITE);
    plot.setShadowPaint(Color.GREEN);
    plot.setDarkerSides(true);
    plot.setLabelFont(DEFAULT_FONT);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(Color.WHITE);
    plot.setLabelOutlinePaint(Color.WHITE);
    plot.setLabelShadowPaint(Color.GRAY);
    plot.setLabelPadding(new RectangleInsets(1, 1, 1, 1));
    plot.setInteriorGap(0.01);
    plot.setMaximumLabelWidth(0.25);

    return plot;
}

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

@Override
protected JFreeChart createPie3DChart() throws JRException {
    JFreeChart jfreeChart = super.createPie3DChart();

    PiePlot3D piePlot3D = (PiePlot3D) jfreeChart.getPlot();
    JRPie3DPlot jrPiePlot = (JRPie3DPlot) getPlot();
    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();
    if (isShowLabels && piePlot3D.getLabelGenerator() != null) {
        piePlot3D.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot3D.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot3D.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    }//w  w  w  .ja  va2  s.  c  om
    piePlot3D.setDarkerSides(true);
    piePlot3D.setDepthFactor(0.1);
    // does not work for 3D
    //      piePlot3D.setShadowXOffset(5);
    //      piePlot3D.setShadowYOffset(10);
    //      piePlot3D.setShadowPaint(new GradientPaint(
    //            0,
    //            getChart().getHeight() / 2,
    //            new Color(41, 120, 162),
    //            0,
    //            getChart().getHeight(),
    //            Color.white)
    //      );

    PieDataset pieDataset = piePlot3D.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
        }
    }

    piePlot3D.setCircular(true);
    return jfreeChart;
}