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

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

Introduction

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

Prototype

public void setOutlinePaint(Paint paint) 

Source Link

Document

Sets the paint used to draw the outline of the plot area and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.ThumbnailDemo1.java

private static JFreeChart createChart2(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 1", piedataset, true, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setDarkerSides(true);/*  w w w .  j  a v  a2 s  .  c  om*/
    pieplot3d.setStartAngle(290D);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setForegroundAlpha(0.5F);
    pieplot3d.setOutlinePaint(null);
    pieplot3d.setNoDataMessage("No data to display");
    return jfreechart;
}

From source file:com.pureinfo.srm.reports.impl.PieChartBuilder.java

/**
 * @throws PureException//from   w  w w. ja  v a 2s .co m
 * @see com.pureinfo.srm.reports.IChartBuilder#draw(java.util.List, int)
 */
public JFreeChart buildChart() {
    Iterator result = m_datas.iterator();
    DefaultPieDataset ds = getDataset(result);

    JFreeChart jfreechart = ChartFactory.createPieChart3D(null, ds, false, false, false);
    jfreechart.setBackgroundPaint(Color.WHITE);

    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setOutlinePaint(Color.GRAY);
    pieplot3d.setOutlineStroke(new BasicStroke(1));
    pieplot3d.setStartAngle(30D);
    pieplot3d.setDepthFactor(0.04);
    pieplot3d.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    pieplot3d.setCircular(false);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setOutlinePaint(Color.WHITE);
    pieplot3d.setInteriorGap(.15);
    Color color = new Color(0xaa, 0xaa, 0xaa, 255);
    pieplot3d.setBaseSectionOutlinePaint(color);
    pieplot3d.setBaseSectionOutlineStroke(new BasicStroke(0));
    pieplot3d.setForegroundAlpha(0.6f);
    pieplot3d.setLabelLinkStroke(new BasicStroke(1));
    pieplot3d.setLabelOutlinePaint(new Color(0x777777));
    pieplot3d.setLabelBackgroundPaint(new Color(0xf1f1f7));
    pieplot3d.setLabelLinkPaint(new Color(0xaa, 0xaa, 0xaa, 60));
    pieplot3d.setNoDataMessage("No data to display");
    pieplot3d.setLabelShadowPaint(new Color(0xdddddd));
    pieplot3d.setLabelFont(new Font("", Font.PLAIN, 10));
    if (m_nType == TYPE_PERCENT) {

        pieplot3d.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}",
                NumberFormat.getNumberInstance(), PERCENT_NUMBER_FORMAT));
    }

    fillChartInfo(ds);
    return jfreechart;
}

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

protected Plot getMapPlot() {
    if (mapPlot == null) {
        PiePlot3D myMapPlot;
        try {//w  w  w .  j  av  a2  s .c  o m
            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:com.estate.pdf.Page.java

protected void drawTaxPie(Rectangle rct, double totalValue, double tax, String taxLabel, String netLabel) {
    double taxPercent = (tax / totalValue) * 100;
    double netValuePercent = 100 - taxPercent;

    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue(taxLabel, taxPercent);
    dataset.setValue(netLabel, netValuePercent);

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setLabelGenerator(new StandardPieItemLabelGenerator());
    plot.setInsets(new Insets(0, 5, 5, 5));
    plot.setToolTipGenerator(new CustomeGenerators.CustomToolTipGenerator());
    plot.setLabelGenerator(new CustomeGenerators.CustomLabelGenerator());
    plot.setSectionPaint(0, new Color(pgRed));
    plot.setSectionPaint(1, new Color(pgGreen));
    plot.setForegroundAlpha(.6f);//w ww.  j av  a 2 s . c  om
    plot.setOutlinePaint(Color.white);
    plot.setBackgroundPaint(Color.white);

    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);

    Rectangle page = rct;

    try {
        Image img = Image.getInstance(chart.createBufferedImage((int) page.getWidth(), (int) page.getHeight()),
                null);
        drawDiagram(img, rct, 0, 72);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

}

From source file:com.tocea.scertify.eclipse.scertifycode.ui.stats.views.GraphStatsView.java

/**
 * Cre le graphe JFreeChart./*  w  ww. ja  v  a 2 s  . c om*/
 * 
 * @param piedataset
 *            : la source de donnes  afficher
 * @return le diagramme
 */
private JFreeChart createChart(final GraphPieDataset piedataset) {

    final JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false);
    jfreechart.setAntiAlias(true);
    jfreechart.setTextAntiAlias(true);

    final PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    // pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0));

    final double angle = 290D;
    pieplot3d.setStartAngle(angle);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    final float foreground = 0.5F;
    pieplot3d.setForegroundAlpha(foreground);
    pieplot3d.setBackgroundAlpha(0.0F);
    pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay);

    pieplot3d.setOutlinePaint(null);
    pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    pieplot3d.setLabelGap(0.02);
    pieplot3d.setLabelOutlinePaint(null);
    pieplot3d.setLabelShadowPaint(null);
    pieplot3d.setLabelBackgroundPaint(Color.WHITE);
    pieplot3d.setBackgroundPaint(Color.WHITE);

    pieplot3d.setInteriorGap(0.02);
    pieplot3d.setMaximumLabelWidth(0.20);

    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 ww  w  . j  a v  a2s . 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  w  w .  j ava 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(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;
}