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

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

Introduction

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

Prototype

public void setDarkerSides(boolean darker) 

Source Link

Document

Sets a flag that controls whether or not the sides of the pie chart are rendered using a darker colour, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:ntpgraphic.PieChart.java

private static JFreeChart createChart(PieDataset piedataset) {
    jfreechart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 1", piedataset, true, true, false);
    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setDarkerSides(true);
    pieplot3d.setStartAngle(36 * 9);/*ww w .  ja  va2 s. com*/
    pieplot3d.setNoDataMessage("No data to display");
    return jfreechart;
}

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);
    pieplot3d.setStartAngle(290D);/*ww  w.  j  a va  2  s. c  o m*/
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setForegroundAlpha(0.5F);
    pieplot3d.setOutlinePaint(null);
    pieplot3d.setNoDataMessage("No data to display");
    return jfreechart;
}

From source file:de.aidger.view.utils.Charts.java

/**
 * Creates a 3D pie chart./*from   w  w  w  .  j  a  v  a2  s. com*/
 * 
 * @param title
 *            the diagram title
 * @param dataset
 *            the dataset.
 * @param width
 *            the width of the chart as image
 * @param height
 *            the height of the chart as image
 * 
 * @return the 3D pie chart as image
 */
public static ImageIcon createPieChart3D(String title, PieDataset dataset, int width, int height) {
    JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false);

    Font titleFont = UIManager.getFont("TitledBorder.font");

    chart.setBackgroundPaint(null);
    chart.getLegend().setBackgroundPaint(null);
    chart.getTitle().setFont(new Font(titleFont.getName(), titleFont.getStyle(), 14));
    chart.getTitle().setPaint(UIManager.getColor("TitledBorder.titleColor"));
    chart.setBorderPaint(null);
    chart.getLegend().setBorder(0, 0, 0, 0);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setForegroundAlpha(0.9f);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setNoDataMessage(_("No data to display."));
    plot.setLabelGenerator(null);
    plot.setInsets(new RectangleInsets(10, 1, 5, 1));
    plot.setBackgroundPaint(null);
    plot.setOutlineVisible(false);
    plot.setDarkerSides(true);

    return new ImageIcon(chart.createBufferedImage(width, height));
}

From source file:taller.GraficoTorta.java

public GraficoTorta(int posX, int posY, double[] datos, String[] labels, String titulo) {

    super("");
    try {//  w  w  w  .  j a  v a 2 s.  com

        DefaultPieDataset defaultpiedataset = new DefaultPieDataset();

        for (int i = 0; i < datos.length; i++)
            defaultpiedataset.setValue(labels[i], datos[i]);

        JFreeChart jfreechart = ChartFactory.createPieChart3D(titulo, defaultpiedataset, true, true, false);
        PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
        pieplot3d.setDarkerSides(true);
        pieplot3d.setStartAngle(0D);
        pieplot3d.setDirection(Rotation.CLOCKWISE);
        pieplot3d.setForegroundAlpha(0.75F);
        pieplot3d.setNoDataMessage("No hay Datos que Mostrar");

        jpanel = new ChartPanel(jfreechart);
        jpanel.setPreferredSize(new Dimension(300, 300));
        setContentPane(jpanel);
        pack();
        RefineryUtilities.centerFrameOnScreen(this);
    } catch (Exception e) {
    }
}

From source file:org.shredzone.bullshitcharts.chart.AgreementPieGenerator.java

@Override
public Plot generate() {
    PieDatasetCreator dataset = new PieDatasetCreator();
    dataset.addChoice("disagree"); // TODO: i18n
    dataset.addChoice("indecisive");
    dataset.addChoice("agree");

    dataset.setFavouriteChoice("agree");
    dataset.setObnoxiousChoice("disagree");
    dataset.setTendency(getTendency());//  w  ww . j av  a2 s  .c  o  m

    PiePlot3D plot = new PiePlot3D(dataset.generate());
    plot.setCircular(true);
    plot.setStartAngle(110d);
    plot.setForegroundAlpha(0.6f);
    plot.setDarkerSides(true);
    plot.setOutlineVisible(false);
    return plot;
}

From source file:net.nosleep.superanalyzer.analysis.views.RatingView.java

private void createChart() {
    _chart = ChartFactory.createPieChart3D(Misc.getString("SONG_RATINGS"), _dataset, false, true, false);

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    plot.setDarkerSides(true);
    plot.setStartAngle(PieRotator.angle);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);/* ww w  .j a  v a2  s .c o m*/
    plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY"));
    plot.setInsets(new RectangleInsets(10, 10, 10, 10));
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));

    _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("SONG_RATINGS_SUBTITLE")));

    ChartUtilities.applyCurrentTheme(_chart);
    plot.setBackgroundPaint(Color.white);
    _chart.setBorderVisible(false);
}

From source file:org.shredzone.bullshitcharts.chart.ChoicePieGenerator.java

@Override
public Plot generate() {
    PieDatasetCreator dataset = new PieDatasetCreator();

    String choice1 = getValue("c1", "");
    String choice2 = getValue("c2", null);
    String choice3 = getValue("c3", null);
    String choice4 = getValue("c4", null);
    String choice5 = getValue("c5", null);

    dataset.addChoice(choice1);//from ww  w  . j av  a 2s  .  c  o m
    dataset.setFavouriteChoice(choice1);
    if (choice2 != null)
        dataset.addChoice(choice2);
    if (choice3 != null)
        dataset.addChoice(choice3);
    if (choice4 != null)
        dataset.addChoice(choice4);
    if (choice5 != null)
        dataset.addChoice(choice5);

    dataset.setTendency(getTendency());

    PiePlot3D plot = new PiePlot3D(dataset.generate());
    plot.setCircular(true);
    plot.setStartAngle(110d);
    plot.setForegroundAlpha(0.6f);
    plot.setDarkerSides(true);
    plot.setOutlineVisible(false);
    return plot;
}

From source file:net.nosleep.superanalyzer.analysis.views.EncodingKindView.java

private void createChart() {

    _chart = ChartFactory.createPieChart3D(Misc.getString("KINDS_OF_MUSIC_FILES"), _dataset, false, true,
            false);//  www . j  a  va  2 s. c om

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    plot.setDarkerSides(true);
    plot.setStartAngle(PieRotator.angle);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setInsets(new RectangleInsets(10, 10, 10, 10));
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));

    _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("KINDS_OF_MUSIC_FILES_SUBTITLE")));

    ChartUtilities.applyCurrentTheme(_chart);
    plot.setBackgroundPaint(Color.white);
    _chart.setBorderVisible(false);

    plot.setIgnoreZeroValues(true);

    // plot.setAutoPopulateSectionPaint(false);

    // Misc.formatChart(plot);
}

From source file:biz.ixnay.pivot.charts.skin.jfree.PieChartViewSkin.java

@Override
protected JFreeChart createChart() {
    PieChartView chartView = (PieChartView) getComponent();

    String title = chartView.getTitle();
    boolean showLegend = chartView.getShowLegend();

    ChartView.CategorySequence categories = chartView.getCategories();
    String seriesNameKey = chartView.getSeriesNameKey();
    List<?> chartData = chartView.getChartData();

    JFreeChart chart;//from w  w w  .  jav  a  2 s. c om
    if (threeDimensional) {
        if (chartData.getLength() > 1) {
            CategorySeriesDataset dataset = new CategorySeriesDataset(categories, seriesNameKey, chartData);

            chart = ChartFactory.createMultiplePieChart3D(title, dataset, TableOrder.BY_ROW, showLegend, false,
                    false);
        } else {
            PieSeriesDataset dataset = new PieSeriesDataset(categories, chartData.get(0));
            chart = ChartFactory.createPieChart3D(title, dataset, showLegend, false, false);

            PiePlot3D plot = (PiePlot3D) chart.getPlot();
            plot.setDarkerSides(darkerSides);
            plot.setDepthFactor(depthFactor);
        }
    } else {
        if (chartData.getLength() > 1) {
            CategorySeriesDataset dataset = new CategorySeriesDataset(categories, seriesNameKey, chartData);

            chart = ChartFactory.createMultiplePieChart(title, dataset, TableOrder.BY_ROW, showLegend, false,
                    false);
        } else {
            PieSeriesDataset dataset = new PieSeriesDataset(categories, chartData.get(0));
            chart = ChartFactory.createPieChart(title, dataset, showLegend, false, false);

            HashMap<String, String> categoryLabels = new HashMap<String, String>();
            for (int i = 0, n = categories.getLength(); i < n; i++) {
                ChartView.Category category = categories.get(i);
                categoryLabels.put(category.getKey(), category.getLabel());
            }

            PiePlot plot = (PiePlot) chart.getPlot();
            for (String categoryKey : explodePercentages) {
                plot.setExplodePercent(categoryLabels.get(categoryKey),
                        explodePercentages.get(categoryKey).doubleValue());
            }
        }
    }

    return chart;
}

From source file:net.nosleep.superanalyzer.analysis.views.QualityView.java

private void createChart() {

    _chart = ChartFactory.createPieChart3D(Misc.getString("SONG_QUALITY"), _dataset, false, true, false);

    PiePlot3D plot = (PiePlot3D) _chart.getPlot();
    plot.setDarkerSides(true);
    plot.setStartAngle(PieRotator.angle);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);//w w  w .  ja va2s  .c o  m
    plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY"));
    plot.setInsets(new RectangleInsets(10, 10, 10, 10));
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));

    _chart.addSubtitle(HomePanel.createSubtitle(Misc.getString("SONG_QUALITY_SUBTITLE")));

    ChartUtilities.applyCurrentTheme(_chart);
    plot.setBackgroundPaint(Color.white);
    _chart.setBorderVisible(false);
}