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

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

Introduction

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

Prototype

public void setStartAngle(double angle) 

Source Link

Document

Sets the starting angle and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:taller.GraficoTorta.java

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

    super("");
    try {// w w w  .  j  av a  2  s . c  o m

        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.pentaho.reporting.engine.classic.demo.ancient.demo.chartdemo.MultiAPIChartDemo.java

/**
 * Creates a sample chart./*from   ww w  .j  av  a 2s .co m*/
 *
 * @return A chart.
 */
private JFreeChart createChart(final int year) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Programming Language of the Year " + year, // chart title
            createSampleDataset(), // data
            true, // include legend
            true, false);

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    //    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo1.java

/**
 * Creates a sample chart./* w  ww  . j  av  a2 s .  co  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {

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

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);

    /*   for (int i=0; i<pulloutFlag.length; i++){
          //System.out.println("\""+pulloutFlag[i]+"\"");
          if (pulloutFlag[i].equals("1")){
      Comparable key = dataset.getKey(i);
      plot.setExplodePercent(key, 0.30);
          }
       }*/

    plot.setNoDataMessage("No data to display");

    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    setCategorySummary(dataset);
    return chart;

}

From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.chartdemo.TableJFreeChartDemo.java

/**
 * Creates a sample chart./*  ww w .  j  av  a 2  s. com*/
 *
 * @return A chart.
 */
private JFreeChart createChart(final int year, final int[] votes) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Programming Language of the Year " + (year), // chart title
            createSampleDataset(votes), // data
            true, // include legend
            true, false);

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    //    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

}

From source file:org.jfree.chart.demo.PieChart3DDemo2.java

/**
 * Creates a new demo./*from  ww  w  .j  av a2s. co  m*/
 *
 * @param title  the frame title.
 */
public PieChart3DDemo2(final String title) {

    super(title);

    // create a dataset...
    final DefaultPieDataset data = new DefaultPieDataset();
    data.setValue("Java", new Double(43.2));
    data.setValue("Visual Basic", new Double(10.0));
    data.setValue("C/C++", new Double(17.5));
    data.setValue("PHP", new Double(32.5));
    data.setValue("Perl", new Double(12.5));

    // create the chart...
    final JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 2", // chart title
            data, // data
            true, // include legend
            true, false);

    chart.setBackgroundPaint(Color.yellow);
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setForegroundAlpha(0.60f);
    plot.setInteriorGap(0.33);
    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

    final Rotator rotator = new Rotator(plot);
    rotator.start();

}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo2.java

/**
 * Creates a demo chart./*from   ww w.  jav  a 2s  .com*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {
    // create the chart...
    JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, // chart title
            dataset, // dataset
            !legendPanelOn, // include legend
            false, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    plot.setDirection(Rotation.ANTICLOCKWISE);
    plot.setForegroundAlpha(0.60f);
    plot.setInteriorGap(0.05); // 0.33 used to work with JFreeChart 1.0.05

    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (pulloutFlag[i].equals("1")) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }

    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    setCategorySummary(dataset);
    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo3.java

/**
 * Creates a sample chart./*from w w  w  .j av  a 2 s.  co  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {

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

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setLabelGenerator(new CustomPieSectionLabelGenerator());

    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (pulloutFlag[i].equals("1")) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }
    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }
    setCategorySummary(dataset);
    return chart;

}

From source file:cz.zcu.kiv.eegdatabase.logic.controller.history.GraphController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    log.debug("Processing creating pie graph");
    String graphType = "";

    List<DownloadStatistic> topDownloadedFilesList = null;
    boolean isGroupAdmin;
    long countFile = 0;

    graphType = request.getParameter("graphType");
    int groupId = Integer.parseInt(request.getParameter("groupId"));
    isGroupAdmin = auth.userIsGroupAdmin();
    response.setContentType("image/png");

    topDownloadedFilesList = historyDao.getTopDownloadHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin,
            groupId);/*from  www .  ja va  2  s .  co m*/

    DefaultPieDataset dataset = new DefaultPieDataset();
    if (groupId != -1) {
        for (int i = 0; i < topDownloadedFilesList.size(); i++) {
            dataset.setValue(topDownloadedFilesList.get(i).getFileName(),
                    new Long(topDownloadedFilesList.get(i).getCount()));
            countFile = countFile + topDownloadedFilesList.get(i).getCount();
        }

        if (historyDao.getCountOfFilesHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin,
                groupId) > countFile) {
            dataset.setValue("Other",
                    historyDao.getCountOfFilesHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin, groupId)
                            - countFile);
        }
    }
    JFreeChart chart = ChartFactory.createPieChart3D("Daily downloads", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, 600, 400);
    response.getOutputStream().close();
    return null;
}

From source file:edu.smc.mediacommons.panels.PasswordPanel.java

private JFreeChart createChart(final PieDataset dataset) {
    final JFreeChart chart = ChartFactory.createPieChart3D("Password Pie Chart", // chart title
            dataset, // data
            true, // include legend
            true, false);/* ww  w .  j a va  2 s .c om*/

    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setLabelGenerator(new CustomLabelGenerator());
    return chart;
}

From source file:com.csc.GUI.ProfileGUIPanel.java

private JFreeChart createChart(PieDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title
            dataset, // data
            true, // include legend
            true, false);//  w  w  w.  j a v a 2 s  . co  m

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return chart;

}