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

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

Introduction

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

Prototype

public void setLabelShadowPaint(Paint paint) 

Source Link

Document

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

Usage

From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.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);
    }//  ww  w  .  ja v  a 2s . c  o  m
    piePlot.setShadowXOffset(0);
    piePlot.setShadowYOffset(0);
    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:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java

/**
 *
 *///from   w w w  .  ja  v  a  2s .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:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java

/**
 * Cre le graphe JFreeChart./*from  ww  w .  j a v a  2  s.  c  o  m*/
 * 
 * @param piedataset
 *            : la source de donnes  afficher
 * @return le diagramme
 */
private JFreeChart createChart(GraphPieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false);
    jfreechart.setAntiAlias(true);
    jfreechart.setTextAntiAlias(true);

    PiePlot pieplot3d = (PiePlot) 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.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay);
    pieplot3d.setCircular(true);

    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:de.dekarlab.moneybuilder.view.AnalyticsView.java

/**
 * Create pie chart.//w w w  .  ja v  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: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   ww w  . j  av  a  2s . c o  m*/
    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: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);/*from   ww w .jav a2s.c om*/

    // 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:kolacer.Kolacer.java

private void upravPlot(PiePlot plot) {
    plot.setSectionOutlinesVisible(false);
    plot.setOutlinePaint(null);//from www  .j av a  2 s.  c  o  m

    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:semaforo.Semaforo.java

public static void SemaforoGrafico(JFreeChart chart) {

    // set a custom background for the chart
    chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), Color.BLACK, new Point(400, 200), Color.BLACK));

    // customise the title position and font
    TextTitle t = chart.getTitle();//from  w  ww.j a v a2s . c o m
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 0));
    PiePlot plot = null;
    plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.00);
    plot.setOutlineVisible(true);

    // use gradients and white borders for the section colours

    plot.setBaseSectionOutlinePaint(Color.BLACK);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(0.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 0));
    plot.setLabelLinkPaint(Color.BLACK);
    plot.setLabelLinkStroke(new BasicStroke(0.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(null);
    plot.setLabelBackgroundPaint(Color.BLACK);
    plot.setLabelShadowPaint(Color.BLACK);

    // add a subtitle giving the data source       

    // Mostramos la grafica dentro del jPanel1
    panel = new ChartPanel(chart);
    panel.setBackground(Color.BLACK);
    panel.repaint();

    jPanel3.setLayout(null);
    jPanel3.setLayout(new java.awt.BorderLayout());
    jPanel3.remove(panel);
    jPanel3.add(panel);

    jPanel3.repaint();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    jTabbedPane1.setPreferredSize(new Dimension(screenSize.width, screenSize.height));
}

From source file:semaforo.Semaforo.java

public static void editGrafico() {
    DecimalFormat df = new DecimalFormat();
    df.setMaximumFractionDigits(2);//www. ja va 2  s . com
    double cfd = 0.0;
    double bull = 0.0;
    double bear = 0.0;
    if (countCfd != 0)
        cfd = (countCfd * 100) / (countBear + countBull + countCfd);
    if (countBull != 0)
        bull = ((countBull * 100) / (countBear + countBull + countCfd));
    if (countBear != 0)
        bear = ((countBear * 100) / (countBear + countBull + countCfd));
    Semaforo.l1.setText("CFD (" + String.format("%.2f", cfd) + "%)");
    Semaforo.l2.setText("BULL (" + String.format("%.2f", bull) + "%)");
    Semaforo.l3.setText("BEAR (" + String.format("%.2f", bear) + "%)");
    DefaultPieDataset pieDataset = new DefaultPieDataset();
    pieDataset.setValue("CFD (" + cfd + "%)", new Integer((int) countCfd));
    pieDataset.setValue("BULL (" + bull + "%)", new Integer((int) countBull));
    pieDataset.setValue("BEAR (" + bear + "%)", new Integer((int) countBear));
    JFreeChart chart = null;
    chart = ChartFactory.createPieChart("", // chart title
            pieDataset, // data
            false, // no legend
            false, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(new GradientPaint(new Point(0, 0), Color.BLACK, new Point(400, 200), Color.BLACK));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 0));
    PiePlot plot = null;
    plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.00);
    plot.setOutlineVisible(true);

    // use gradients and white borders for the section colours

    plot.setBaseSectionOutlinePaint(Color.BLACK);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(0.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 0));
    plot.setLabelLinkPaint(Color.BLACK);
    plot.setLabelLinkStroke(new BasicStroke(0.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.BLACK);
    plot.setLabelBackgroundPaint(null);
    plot.setLabelBackgroundPaint(Color.BLACK);
    plot.setLabelShadowPaint(Color.BLACK);

    // add a subtitle giving the data source       

    // Mostramos la grafica dentro del jPanel1
    Semaforo.panel.setChart(chart);
}

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);/*  w  w  w  . j ava 2  s  . 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));
    }
}