Example usage for org.jfree.chart.plot PiePlot setLabelOutlinePaint

List of usage examples for org.jfree.chart.plot PiePlot setLabelOutlinePaint

Introduction

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

Prototype

public void setLabelOutlinePaint(Paint paint) 

Source Link

Document

Sets the section label outline paint and sends a PlotChangeEvent to all registered listeners.

Usage

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

/**
 *
 *//*from ww  w .j  av  a2 s. c  o  m*/
protected JFreeChart createPieChart() throws JRException {
    JFreeChart jfreeChart = super.createPieChart();

    PiePlot piePlot = (PiePlot) jfreeChart.getPlot();
    piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    piePlot.setShadowXOffset(5);
    piePlot.setShadowYOffset(10);
    piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0,
            getChart().getHeight(), Color.white));
    PieDataset pieDataset = piePlot.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
            //makes pie colors darker
            //piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
        }
    }

    piePlot.setCircular(true);
    return jfreeChart;
}

From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java

/**
 * Create pie chart.//from ww w .  j  av a 2  s  .co  m
 * 
 * @param dataset
 * @param title
 * @return
 */
protected JFreeChart createPieChart(final PieDataset dataset, final String title) {
    final JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false);
    final PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage(App.getGuiProp("report.nodata.msg"));
    plot.setCircular(true);
    // plot.set
    plot.setLabelGap(0.02);
    plot.setBackgroundPaint(Color.white);
    chart.removeLegend();
    plot.setBackgroundPaint(Color.white);
    Iterator<?> it = dataset.getKeys().iterator();
    int color = 0;
    while (it.hasNext()) {
        plot.setSectionPaint((String) it.next(), COLORS[color]);
        color++;
        if (COLORS.length == color) {
            color = 0;
        }
    }
    plot.setLabelBackgroundPaint(Color.white);
    StandardPieSectionLabelGenerator slbl = new StandardPieSectionLabelGenerator("{0} {2} ({1})",
            new DecimalFormat("#,##0"), new DecimalFormat("0%"));
    plot.setLabelGenerator(slbl);
    plot.setLabelFont(new Font("Helvetica", Font.PLAIN, 14));
    plot.setLabelOutlinePaint(Color.white);
    plot.setLabelShadowPaint(Color.white);
    plot.setShadowPaint(Color.white);
    plot.setIgnoreZeroValues(true);
    return chart;
}

From source file:lucee.runtime.tag.Chart.java

private void setBackground(JFreeChart chart, Plot plot) {
    //Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor;

    chart.setBackgroundPaint(backgroundcolor);
    plot.setBackgroundPaint(databackgroundcolor);
    chart.setBorderPaint(databackgroundcolor);

    plot.setOutlineVisible(false);/*  ww w .j  a v a 2s.  c  o  m*/

    // Pie
    if (plot instanceof PiePlot) {
        PiePlot pp = (PiePlot) plot;
        pp.setLabelOutlinePaint(backgroundcolor);
        pp.setLabelBackgroundPaint(backgroundcolor);
        pp.setLabelShadowPaint(backgroundcolor);
        pp.setShadowPaint(backgroundcolor);
    }
    // Bar
    /*if(plot instanceof CategoryPlot) {
       CategoryPlot cp=(CategoryPlot) plot;
               
    }*/
}

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

@Override
protected JFreeChart createPieChart() throws JRException {
    JFreeChart jfreeChart = super.createPieChart();
    PiePlot piePlot = (PiePlot) jfreeChart.getPlot();
    JRPiePlot jrPiePlot = (JRPiePlot) getPlot();
    boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels();

    if (isShowLabels && piePlot.getLabelGenerator() != null) {
        piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
        piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    }/*from   w w  w  .  j ava2s .c  om*/
    piePlot.setShadowXOffset(5);
    piePlot.setShadowYOffset(10);
    piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0,
            getChart().getHeight(), Color.white));
    PieDataset pieDataset = piePlot.getDataset();
    if (pieDataset != null) {
        for (int i = 0; i < pieDataset.getItemCount(); i++) {
            piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
            //makes pie colors darker
            //piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
        }
    }

    piePlot.setCircular(true);
    return jfreeChart;
}

From source file:kolacer.Kolacer.java

private void upravPlot(PiePlot plot) {
    plot.setSectionOutlinesVisible(false);
    plot.setOutlinePaint(null);/*  ww  w . j  av a 2s  .  c  om*/

    if (jRad_barvy_manual.isSelected()) {
        for (Udaj u : udaje) {
            plot.setSectionPaint(u.hodnota, u.barva);
        }
    } else if (jRad_barvy_auto.isSelected()) {
        Barvy.nastavBarvy(plot);
    } else if (jRad_barvy_gradient.isSelected()) {
        Barvy.nastavBarvy(plot, barvaGradA, barvaGradB);
    }

    if (!jCHB_popisky.isSelected())
        plot.setLabelGenerator(null);
    else {
        plot.setLabelBackgroundPaint(new Color(0, 0, 0, 0));
        plot.setLabelOutlinePaint(null);
        plot.setLabelShadowPaint(null);
        plot.setSimpleLabels(true);
        plot.setInsets(new RectangleInsets(5, 5, 5, 400));
        plot.setLabelFont(popisekGrafuFont);
        //plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1} hl. ({2})"));
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1}"));
    }
    plot.setBackgroundPaint(null);
    plot.setShadowPaint(null);
    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{1} ({2}) - {0}"));
}

From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java

private void customizePiePlot(ChartDefinition cd, PiePlot plot, PieCollection pie) {
    PlotInformation pi = cd.getPlotInformation();

    plot.setBackgroundPaint(null);/*from   www.  j a  va  2s. c  o  m*/
    plot.setOutlineVisible(false);
    customizeBasicPlot(plot, pi);

    List<RenderableDataItem> rows = cd.getSeries();
    int len = (rows == null) ? 0 : rows.size();
    ChartDataItem di;
    iComponentPainter bp;
    Paint p = null;

    if (len > 0) {
        rows = rows.get(0).getItems();
        len = rows.size();
    }

    for (int i = 0; i < len; i++) {
        di = (ChartDataItem) rows.get(i);
        bp = di.getComponentPainter();

        iPlatformPaint pp;

        if (bp == null) {
            p = di.getBackground();
        } else if (bp.getBackgroundPainter() != null) {
            pp = bp.getBackgroundPainter().getPaint(100, 100);
            p = (pp == null) ? null : pp.getPaint();
        }

        if (p == null) {
            p = getDefaultColor(i);
        }

        plot.setSectionPaint(di.getDomainValue().toString(), p);
    }

    if (pie.getExplodedPiece() != null) {
        plot.setExplodePercent(pie.getExplodedPiece(), 0.50);
    }

    plot.setLabelBackgroundPaint(null);
    plot.setLabelOutlinePaint(null);
    plot.setLabelShadowPaint(null);

    UIColor fg = cd.getTextColor(plotLabelColor);
    UIFont font = cd.getTextFont(plotLabelFont);

    plot.setLabelFont(font);
    plot.setLabelPaint(fg);

    if (cd.isShowPlotLabels()) {
        String format = (pi == null) ? null : pi.getLabelsFormat();

        plot.setLabelGenerator(new PieLabelGenerator(cd, format));
    }

    if (cd.isShowToolTips()) {
        plot.setToolTipGenerator(new PieToolTipLabelGenerator(cd, false));
    }
}