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

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

Introduction

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

Prototype

public void setLabelOutlineStroke(Stroke stroke) 

Source Link

Document

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

Usage

From source file:org.eobjects.datacleaner.util.ChartUtils.java

public static void applyStyles(JFreeChart chart) {
    TextTitle title = chart.getTitle();//from www  . j  a  v a  2  s. c o  m
    if (title != null) {
        title.setFont(WidgetUtils.FONT_HEADER1);
        title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    }

    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        Title subtitle = chart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL);
        }
    }

    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setItemFont(WidgetUtils.FONT_SMALL);
    }

    // transparent background
    chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    chart.setBorderVisible(false);

    final Plot plot = chart.getPlot();
    plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d));
    plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlineVisible(true);

    if (plot instanceof PiePlot) {
        // tweaks for pie charts
        final PiePlot piePlot = (PiePlot) plot;
        piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setBaseSectionOutlineStroke(normalStroke);
        piePlot.setLabelFont(WidgetUtils.FONT_SMALL);
        piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT);
        piePlot.setLabelOutlineStroke(normalStroke);
        piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setSectionOutlinesVisible(false);
        piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    } else if (plot instanceof CategoryPlot) {
        // tweaks for bar charts
        final CategoryPlot categoryPlot = (CategoryPlot) plot;

        int columnCount = categoryPlot.getDataset().getColumnCount();
        if (columnCount > 1) {
            categoryPlot.setDomainGridlinesVisible(true);
        } else {
            categoryPlot.setDomainGridlinesVisible(false);
        }
        categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK);
        categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);

        categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.setDrawingSupplier(new DCDrawingSupplier());

        final CategoryItemRenderer renderer = categoryPlot.getRenderer();
        renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        renderer.setBaseOutlineStroke(wideStroke);

        if (renderer instanceof BarRenderer) {
            BarRenderer barRenderer = (BarRenderer) renderer;
            barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT);
            barRenderer.setBarPainter(new StandardBarPainter());
        }

    } else if (plot instanceof XYPlot) {
        // tweaks for line charts
        final XYPlot xyPlot = (XYPlot) plot;

        xyPlot.setDrawingSupplier(new DCDrawingSupplier());

        xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);

        final XYItemRenderer renderer = xyPlot.getRenderer();
        final int seriesCount = xyPlot.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            renderer.setSeriesStroke(i, wideStroke);
        }
    }
}

From source file:org.datacleaner.util.ChartUtils.java

public static void applyStyles(JFreeChart chart) {
    TextTitle title = chart.getTitle();/*from www.  j  a  va 2s .  c o m*/
    if (title != null) {
        title.setFont(WidgetUtils.FONT_HEADER1);
        title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    }

    for (int i = 0; i < chart.getSubtitleCount(); i++) {
        Title subtitle = chart.getSubtitle(i);
        if (subtitle instanceof TextTitle) {
            ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL);
        }
    }

    LegendTitle legend = chart.getLegend();
    if (legend != null) {
        legend.setItemFont(WidgetUtils.FONT_SMALL);
    }

    // transparent background
    chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    chart.setBorderVisible(false);

    final Plot plot = chart.getPlot();
    plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d));
    plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST);
    plot.setOutlineVisible(true);

    if (plot instanceof PiePlot) {
        // tweaks for pie charts
        final PiePlot piePlot = (PiePlot) plot;
        piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setBaseSectionOutlineStroke(STROKE_NORMAL);
        piePlot.setLabelFont(WidgetUtils.FONT_SMALL);
        piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT);
        piePlot.setLabelOutlineStroke(STROKE_NORMAL);
        piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK);
        piePlot.setSectionOutlinesVisible(false);
        piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
        piePlot.setDrawingSupplier(new DCDrawingSupplier());

    } else if (plot instanceof CategoryPlot) {
        // tweaks for bar charts
        final CategoryPlot categoryPlot = (CategoryPlot) plot;

        int columnCount = categoryPlot.getDataset().getColumnCount();
        if (columnCount > 1) {
            categoryPlot.setDomainGridlinesVisible(true);
        } else {
            categoryPlot.setDomainGridlinesVisible(false);
        }
        categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK);
        categoryPlot.setDomainGridlinePosition(CategoryAnchor.END);

        categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        categoryPlot.setDrawingSupplier(new DCDrawingSupplier());

        final CategoryItemRenderer renderer = categoryPlot.getRenderer();
        renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK);
        renderer.setBaseOutlineStroke(STROKE_WIDE);

        if (renderer instanceof BarRenderer) {
            BarRenderer barRenderer = (BarRenderer) renderer;
            barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT);
            barRenderer.setBarPainter(new StandardBarPainter());
        }

    } else if (plot instanceof XYPlot) {
        // tweaks for line charts
        final XYPlot xyPlot = (XYPlot) plot;

        xyPlot.setDrawingSupplier(new DCDrawingSupplier());

        xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL);
        xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL);

        final XYItemRenderer renderer = xyPlot.getRenderer();
        final int seriesCount = xyPlot.getSeriesCount();
        for (int i = 0; i < seriesCount; i++) {
            renderer.setSeriesStroke(i, STROKE_WIDE);
        }
    }
}

From source file:fr.gouv.diplomatie.applitutoriel.utility.Graphique.java

/**
 * Creer camember3 d./*ww  w .  j  a v  a  2 s .co m*/
 *
 * @param title
 *            the title
 * @param dataset
 *            the dataset
 * @param legend
 *            the legend
 * @param tooltips
 *            the tooltips
 * @param urls
 *            the urls
 * @return the j free chart
 * @throws FontFormatException
 *             the font format exception
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 */
public static JFreeChart creerCamember3D(final String title, final DefaultPieDataset dataset,
        final boolean legend, final boolean tooltips, final boolean urls)
        throws FontFormatException, IOException {

    dataset.sortByValues(SortOrder.DESCENDING);
    final JFreeChart jfreeChart = ChartFactory.createPieChart3D(title, dataset, legend, tooltips, urls);

    jfreeChart.setBackgroundPaint(Color.white);
    jfreeChart.setBorderVisible(true);
    jfreeChart.getLegend().setPosition(RectangleEdge.LEFT);
    final GraphicsEnvironment graph = GraphicsEnvironment.getLocalGraphicsEnvironment();
    final InputStream inputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream("hornet/framework/font/LiberationSans-Bold.ttf");
    final Font font = Font.createFont(Font.TRUETYPE_FONT, inputStream);
    graph.registerFont(font);
    jfreeChart.getLegend().setItemFont(new Font("Liberation Sans", Font.BOLD, 11));
    jfreeChart.getLegend().setHeight(400);
    jfreeChart.getLegend().setBorder(0, 0, 0, 0);
    jfreeChart.setTitle(new TextTitle(title, new Font("Liberation Sans", Font.BOLD, 16)));
    final PiePlot piePlot = (PiePlot) jfreeChart.getPlot();

    final int nbData = dataset.getItemCount();
    int cptColor = 0;
    for (int x = 0; x < nbData; x++) {
        if (cptColor >= listColor.size()) {
            cptColor = 0;
        }
        piePlot.setSectionPaint(dataset.getKey(x), listColor.get(cptColor));

        cptColor++;

    }

    piePlot.setForegroundAlpha(0.5f);
    piePlot.setLabelFont(new Font("Liberation Sans", Font.BOLD, 12));
    piePlot.setLabelOutlineStroke(null);
    piePlot.setLabelLinkStroke(new BasicStroke(0.4f));
    piePlot.setLabelBackgroundPaint(Color.WHITE);
    piePlot.setLabelLinkStyle(PieLabelLinkStyle.STANDARD);
    piePlot.setBackgroundAlpha(0);
    piePlot.setOutlineVisible(false);
    piePlot.setForegroundAlpha(1); // transparence
    piePlot.setInteriorGap(0); // le camembert occupe plus de place
    piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1}"));
    piePlot.setStartAngle(70);
    piePlot.setCircular(true); // force pour avoir un cercle et pas un oval
    piePlot.setMaximumLabelWidth(0.20);
    piePlot.setBaseSectionOutlinePaint(Color.BLACK); // bordure du camembert

    return jfreeChart;

}

From source file:st.jigasoft.dbutil.util.ReportTheme.java

public static void circularTheme(JFreeChart chart, String... colunsName) {
    chart.setBackgroundPaint(/*from   w w  w  .  j  a v  a  2 s  .c o m*/
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);
    int iCount = 0;

    // use gradients and white borders for the section colours
    for (Object s : colunsName) {
        plot.setSectionPaint(s.toString(), createGradientPaint(new Color(200, 200, 255), colorItems(iCount++)));
        if (iCount == MAX_COLUNS_COLOR)
            iCount = 0;
    }

    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    //        // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
}

From source file:org.jfree.graphics2d.demo.SVGPieChartDemo1.java

/**
 * Creates a chart.//from ww  w. ja v a 2  s  .  c  o m
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset);
    chart.removeLegend();

    // set a custom background for the chart
    chart.setBackgroundPainter(new GradientPainter(new Color(20, 20, 20), RectangleAnchor.TOP_LEFT,
            Color.DARK_GRAY, RectangleAnchor.BOTTOM_RIGHT));

    // 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, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPainter(null);
    plot.setInteriorGap(0.04);
    plot.setBorderPainter(null);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:PieChartDemo1.java

/**
 * Creates a chart./*from w w  w.j a  va 2s .c om*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

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

    // 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, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

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

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:icaro.aplicaciones.recursos.recursoEstadistica.jFreeChart.demo.PieChartDemo1.java

/**
 * Creates a chart.//from w w  w  .j  ava 2  s  .com
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

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

    // 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, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    //        plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

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

    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:by.bsu.zmiecer.PieChartDemo1.java

/**
 * Creates a chart./* w  ww .  j av a  2  s. c  om*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("   ", // chart title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

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

    // 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, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    //plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    //plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    //plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    //plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

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

    /*
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
        new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    */
    return chart;

}

From source file:org.gephi.desktop.context.ContextPieChart.java

public ContextPieChart() {
    data = new DefaultPieDataset();
    final JFreeChart chart = ChartFactory.createPieChart("Employee Survey", data, false, false, false);
    chart.setTitle(new TextTitle());
    chart.setBackgroundPaint(null);/*w  ww.j  av a  2s .c o  m*/
    chart.setPadding(new RectangleInsets(0, 0, 0, 0));
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setShadowPaint(null);
    plot.setSimpleLabels(true);
    plot.setLabelBackgroundPaint(null);
    plot.setLabelOutlineStroke(null);
    plot.setLabelShadowPaint(null);
    plot.setOutlineVisible(false);
    plot.setLabelFont(new java.awt.Font("Tahoma", 0, 10));
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelGap(0.5);
    plot.setCircular(true);
    plot.setInteriorGap(0);
    plot.setBackgroundPaint(null);
    plot.setBackgroundAlpha(1f);
    plot.setSectionPaint(NbBundle.getMessage(getClass(), "ContextPieChart.visible"), new Color(0x222222));
    plot.setSectionPaint(NbBundle.getMessage(getClass(), "ContextPieChart.notVisible"), new Color(0xDDDDDD));
    chartPanel = new ChartPanel(chart, 100, 100, 10, 10, 300, 300, true, false, false, false, false, false);
    ((FlowLayout) chartPanel.getLayout()).setHgap(0);
    ((FlowLayout) chartPanel.getLayout()).setVgap(0);
    chartPanel.setOpaque(false);
    chartPanel.setPopupMenu(null);
}

From source file:org.gephi.desktop.partition.PartitionPie.java

public void setup(Partition partition) {
    data = new DefaultPieDataset();
    for (Part p : partition.getParts()) {
        data.setValue(p.getDisplayName(), p.getPercentage());
    }/* w ww.  java 2 s . co  m*/
    final JFreeChart chart = ChartFactory.createPieChart("test", data, false, false, false);
    chart.setTitle(new TextTitle());
    chart.setBackgroundPaint(null);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setShadowPaint(null);
    //plot.setSimpleLabels(true);
    plot.setLabelBackgroundPaint(Color.WHITE);
    plot.setLabelOutlineStroke(null);
    plot.setLabelShadowPaint(null);
    plot.setOutlineVisible(false);
    plot.setLabelFont(new java.awt.Font("Tahoma", 0, 10));
    plot.setLabelPaint(Color.BLACK);
    //plot.setLabelGap(0.05);
    plot.setCircular(true);
    plot.setBackgroundPaint(null);
    plot.setBackgroundAlpha(1f);
    for (Part p : partition.getParts()) {
        plot.setSectionPaint(p.getDisplayName(), p.getColor());
    }
    chartPanel = new ChartPanel(chart, true);
    chartPanel.setOpaque(false);
    chartPanel.setPopupMenu(null);
    add(chartPanel, BorderLayout.CENTER);
}