Example usage for org.jfree.util Rotation ANTICLOCKWISE

List of usage examples for org.jfree.util Rotation ANTICLOCKWISE

Introduction

In this page you can find the example usage for org.jfree.util Rotation ANTICLOCKWISE.

Prototype

Rotation ANTICLOCKWISE

To view the source code for org.jfree.util Rotation ANTICLOCKWISE.

Click Source Link

Document

The reverse order renders the primary dataset first.

Usage

From source file:userInterface.cdcRole.DecisionChartJPanel.java

private static JFreeChart createChart1(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart3D("Top 5 Hospitals (For Orders Placed)", piedataset,
            true, false, false);/*from ww w .  j  av a2 s  . c  o m*/
    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setStartAngle(270D);
    pieplot3d.setDirection(Rotation.ANTICLOCKWISE);
    pieplot3d.setForegroundAlpha(0.6F);
    return jfreechart;
}

From source file:userInterface.cdcRole.DecisionChartJPanel.java

private static JFreeChart createChart2(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart3D("Top 5 Vaccines", piedataset, true, false, false);
    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setStartAngle(270D);//from  ww  w.  jav a 2 s  . c o  m
    pieplot3d.setDirection(Rotation.ANTICLOCKWISE);
    pieplot3d.setForegroundAlpha(0.6F);
    return jfreechart;
}

From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewPieChartPanel.java

/**
 * @param dataset//from   w w  w . ja v a  2s .  c om
 *            the data to be displayed by the pie chart
 * @param title
 *            the title of the chart @return the pie chart to be displayed
 */
private static JFreeChart createChart(PieDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();// 3D pie chart. the cats
                                                 // are going to love
                                                 // this.
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(true);
    plot.setLabelGap(0.02);
    plot.setStartAngle(270);
    plot.setDirection(Rotation.ANTICLOCKWISE);
    //Rotator rotator = new Rotator(plot);
    //rotator.start();
    return chart;

}

From source file:org.pentaho.plugin.jfreereport.reportcharts.PieChartExpression.java

protected void configureChart(final JFreeChart chart) {
    super.configureChart(chart);

    final Plot plot = chart.getPlot();
    final PiePlot pp = (PiePlot) plot;
    final PieDataset pieDS = pp.getDataset();
    pp.setDirection(rotationClockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE);
    if ((explodeSegment != null) && (explodePct != null)) {
        configureExplode(pp);/*from  w ww .j  a  v  a2s .  co m*/
    }
    if (StringUtils.isEmpty(getTooltipFormula()) == false) {
        pp.setToolTipGenerator(new FormulaPieTooltipGenerator(getRuntime(), getTooltipFormula()));
    }
    if (StringUtils.isEmpty(getUrlFormula()) == false) {
        pp.setURLGenerator(new FormulaPieURLGenerator(getRuntime(), getUrlFormula()));
    }

    pp.setIgnoreNullValues(ignoreNulls);
    pp.setIgnoreZeroValues(ignoreZeros);
    if (Boolean.FALSE.equals(getItemsLabelVisible())) {
        pp.setLabelGenerator(null);
    } else {
        final ExpressionRuntime runtime = getRuntime();
        final Locale locale = runtime.getResourceBundleFactory().getLocale();

        final FastDecimalFormat fastPercent = new FastDecimalFormat(FastDecimalFormat.TYPE_PERCENT, locale);
        final FastDecimalFormat fastInteger = new FastDecimalFormat(FastDecimalFormat.TYPE_INTEGER, locale);

        final DecimalFormat numFormat = new DecimalFormat(fastInteger.getPattern(),
                new DecimalFormatSymbols(locale));
        numFormat.setRoundingMode(RoundingMode.HALF_UP);

        final DecimalFormat percentFormat = new DecimalFormat(fastPercent.getPattern(),
                new DecimalFormatSymbols(locale));
        percentFormat.setRoundingMode(RoundingMode.HALF_UP);

        final StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator(pieLabelFormat,
                numFormat, percentFormat);
        pp.setLabelGenerator(labelGen);

        final StandardPieSectionLabelGenerator legendGen = new StandardPieSectionLabelGenerator(
                pieLegendLabelFormat, numFormat, percentFormat);
        pp.setLegendLabelGenerator(legendGen);
    }

    if (StringUtils.isEmpty(getLabelFont()) == false) {
        pp.setLabelFont(Font.decode(getLabelFont()));
    }

    if (pieDS != null) {
        final String[] colors = getSeriesColor();
        for (int i = 0; i < colors.length; i++) {
            if (i < pieDS.getItemCount()) {
                pp.setSectionPaint(pieDS.getKey(i), parseColorFromString(colors[i]));
            } else {
                break;
            }
        }
    }

    if (shadowPaint != null) {
        pp.setShadowPaint(shadowPaint);
    }
    if (shadowXOffset != null) {
        pp.setShadowXOffset(shadowXOffset.doubleValue());
    }
    if (shadowYOffset != null) {
        pp.setShadowYOffset(shadowYOffset.doubleValue());
    }
    pp.setCircular(circular);

    if (isShowBorder() == false || isChartSectionOutline() == false) {
        chart.setBorderVisible(false);
        chart.getPlot().setOutlineVisible(false);
    }

}

From source file:org.jivesoftware.openfire.reporting.graph.GraphEngine.java

/**
 * Creates a Pie Chart based on map.//  w  ww  . j  a v  a  2 s  .co m
 *
 * @return the Pie Chart generated.
 */
public JFreeChart getPieChart(Map<String, Double> pieValues) {
    DefaultPieDataset dataset = new DefaultPieDataset();

    for (String key : pieValues.keySet()) {
        dataset.setValue(key, pieValues.get(key));
    }

    JFreeChart chart = ChartFactory.createPieChart3D(null, // chart title
            dataset, // data
            true, // include legend
            true, false);

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(false);
    chart.setBorderPaint(null);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(new Font("SansSerif", Font.BOLD, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(true);
    plot.setLabelGap(0.02);
    plot.setOutlinePaint(null);
    plot.setLabelLinksVisible(false);

    plot.setLabelGenerator(null);

    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}"));

    plot.setStartAngle(270);
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setForegroundAlpha(0.60f);
    plot.setInteriorGap(0.33);

    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java

private JFreeChart createPieChart(String titleLabel, PieDataset dataset) {
    // System.out.println("rotation="+rotation);
    if (dimension.equalsIgnoreCase("3D")) {
        JFreeChart chart = ChartFactory.createPieChart3D(titleLabel, // chart title
                dataset, // data
                true, // include legend
                true, false);// w w  w .ja v a2 s. c  o m

        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        if (rotation.equalsIgnoreCase("clockwise")) {
            plot.setStartAngle(290);
            plot.setDirection(Rotation.CLOCKWISE);
            Rotator rotator = new Rotator(plot);
            rotator.start();
        } else if (rotation.equalsIgnoreCase("counter_clockwise")) {
            plot.setStartAngle(290);
            plot.setDirection(Rotation.ANTICLOCKWISE);
            Rotator rotator = new Rotator(plot);
            rotator.start();
        }
        plot.setForegroundAlpha(0.5f);
        plot.setNoDataMessage("No data to display");
        return chart;
    } //end of 3D

    //2D ring
    if (rotation.equalsIgnoreCase("ring")) {
        JFreeChart chart = ChartFactory.createRingChart(titleLabel, // chart title
                dataset, // data
                false, // include legend
                true, false);

        RingPlot plot = (RingPlot) chart.getPlot();
        plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
        plot.setNoDataMessage("No data available");
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        return chart;
    }

    //2D
    JFreeChart chart = ChartFactory.createPieChart(titleLabel, // chart title
            dataset, // data
            true, // include legend
            true, false);
    TextTitle title = chart.getTitle();
    title.setToolTipText("A title tooltip!");

    PiePlot plot = (PiePlot) chart.getPlot();
    if (rotation.equalsIgnoreCase("clockwise")) {
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        Rotator rotator = new Rotator(plot);
        rotator.start();
    } else if (rotation.equalsIgnoreCase("counter_clockwise")) {
        plot.setStartAngle(290);
        plot.setDirection(Rotation.ANTICLOCKWISE);
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    return chart;
}