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

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

Introduction

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

Prototype

public PiePlot3D() 

Source Link

Document

Creates a new instance with no dataset.

Usage

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 w w. ja  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(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: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;// w  ww .  j  a  va  2 s  .c  o  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.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java

protected Plot getMapPlot() {
    if (mapPlot == null) {
        PiePlot3D myMapPlot;// ww w  .j a  v a  2s  .  c  o m
        try {
            myMapPlot = (PiePlot3D) getOutlinePlot().clone();
        } catch (CloneNotSupportedException e) {
            Logger.getLogger(getClass()).error("Error cloning the PieChartSymbol's plot, check consistency");
            myMapPlot = new PiePlot3D();
        }

        myMapPlot.setBackgroundPaint(null);
        myMapPlot.setOutlinePaint(null);
        myMapPlot.setLabelBackgroundPaint(null);
        myMapPlot.setLabelGenerator(null);
        myMapPlot.setLabelLinksVisible(false);
        mapPlot = myMapPlot;
    }
    return mapPlot;
}

From source file:org.gvsig.symbology.fmap.symbols.PieChart3DSymbol.java

protected Plot getOutlinePlot() {
    if (outlinePlot == null) {
        PiePlot3D myMapPlot = new PiePlot3D();

        myMapPlot.setLabelGap(0);//from  w  w  w  . ja  v  a  2s.  c o  m
        myMapPlot.setIgnoreZeroValues(ignoreZeroValues);

        updateDataset();

        myMapPlot.setDataset(new DefaultPieDataset(dataset));
        myMapPlot.setDirection(clockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE);
        myMapPlot.setDepthFactor(depthFactor);
        myMapPlot.setMinimumArcAngleToDraw(minimumAngleToDraw);
        myMapPlot.setCircular(circular);
        myMapPlot.setStartAngle(getRotation());
        /*
         * myMapPlot.setDarkerSides(false); // requires jfreechart 1.0.10
         * myMapPlot.setForegroundAlpha(foregroundAlpha); // requires
         * jfreechart 1.0.10
         */
        outlinePlot = myMapPlot;
    }
    return outlinePlot;
}