Example usage for org.jfree.util Rotation CLOCKWISE

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

Introduction

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

Prototype

Rotation CLOCKWISE

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

Click Source Link

Document

Clockwise.

Usage

From source file:graphic.Grafico.java

private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico,
        float transparencia, String tipo) {
    DefaultPieDataset data = new DefaultPieDataset();

    for (int i = 0; i < nome.toArray().length; i++) {
        data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString()));
    }//  w w  w  . j a  va  2  s .  c  o m

    JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true);

    java.awt.Color cor = new java.awt.Color(200, 200, 200);
    chart.setBackgroundPaint(cor);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setLabelLinksVisible(true);
    plot.setNoDataMessage("No existem dados para serem exibidos no grfico");

    plot.setStartAngle(90);
    plot.setDirection(Rotation.CLOCKWISE);

    plot.setForegroundAlpha(transparencia);
    plot.setInteriorGap(0.20);

    ChartPanel chartPanel = new ChartPanel(chart);

    return chartPanel;
}

From source file:br.com.ifpb.models.Grafico.java

/**
 * /*w  w  w .ja  v  a 2 s.  c o  m*/
 * @param nome
 * @param valor
 * @param tituloGrafico
 * @param transparencia
 * @param tipo
 * @return 
 */
private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico,
        float transparencia, String tipo) {

    DefaultPieDataset data = new DefaultPieDataset();

    for (int i = 0; i < nome.toArray().length; i++) {
        data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString()));
    }

    JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true);
    java.awt.Color cor = new java.awt.Color(200, 200, 200);
    chart.setBackgroundPaint(cor);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setLabelLinksVisible(true);
    plot.setNoDataMessage("No existem dados para serem exibidos ");

    plot.setStartAngle(90);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(transparencia);
    plot.setInteriorGap(0.20);

    ChartPanel chartPanel = new ChartPanel(chart);

    return chartPanel;
}

From source file:utils.Graphs.java

public static File generate(File baseFolder, String titles[], int[] values, Color backgroundColor) {
    DefaultPieDataset dataset = new DefaultPieDataset();

    // add our data values
    int i = -1;//from   w  w w.ja  v a  2s .c o m
    for (String title : titles) {
        i++;
        dataset.setValue(title, values[i]);
    }

    final JFreeChart chart =
            //                ChartFactory.createPieChart("", dataset, true, true, false);

            ChartFactory.createPieChart("", // chart title
                    dataset, // data
                    true, // include legend
                    true, false);

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

    //        final PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(backgroundColor);

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

    chart.setBorderVisible(false);
    chart.getPlot().setOutlineVisible(false);
    chart.getLegend().setFrame(BlockBorder.NONE);

    // get the same background
    chart.setBackgroundPaint(backgroundColor);
    chart.getLegend().setBackgroundPaint(backgroundColor);

    // hide the shadow effects
    plot.setShadowXOffset(0);
    plot.setShadowYOffset(0);

    //chart.getLegend().setVisible(false);

    plot.setCircular(true);
    //plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}", NumberFormat.getNumberInstance(), NumberFormat
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}", NumberFormat.getNumberInstance(),
            NumberFormat.getPercentInstance()));
    plot.setNoDataMessage("No data found.");

    Color greenColor = new Color(0x8FBC0C);
    Color redColor = new Color(0xFF0000);
    //Color redColor = new Color(0xDA6022);

    plot.setSectionPaint(0, greenColor);
    plot.setSectionPaint(1, redColor);
    plot.setSectionOutlinesVisible(true);

    final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
    final File file = new File(baseFolder, "chart.png");
    try {
        ChartUtilities.saveChartAsPNG(file, chart, 200, 160, info);
    } catch (IOException ex) {
        Logger.getLogger(Graphs.class.getName()).log(Level.SEVERE, null, ex);
    }
    //        
    ////        final ChartPanel chartPanel = new ChartPanel(chart, true);
    //       final ChartPanel chartPanel = new ChartPanel(chart, true);
    //        chartPanel.setMinimumDrawWidth(0);
    //        chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE);
    //        chartPanel.setMinimumDrawHeight(0);
    //        chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE);
    //        JDialog dialog = new JDialog();
    //        dialog.add(chartPanel);
    //        dialog.setLayout(new GridLayout(1, 1));
    //        dialog.setSize(400, 200);
    //        dialog.setVisible(true);

    return file;
}

From source file:taller.GraficoTorta.java

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

    super("");
    try {//from  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:gavisualizer.PieChart.java

@Override
public void generate() {
    // Creates Pie Chart from variables
    JFreeChart chart = ChartFactory.createPieChart(_title, // chart title
            _dataset, // data
            false, // include legend
            false, false);//from  www  . j a v  a 2  s .  c  om

    // Set Plot canvas color and direction
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setBackgroundPaint(Color.WHITE);

    /*
    *  Use these to edit the decimal percentage: 
    *       NumberFormat nf = NumberFormat.getPercentInstance();
    *       nf.setRoundingMode(RoundingMode.);
    *       nf.setMinimumFractionDigits(2);
    *       plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}", NumberFormat.getNumberInstance(), nf));
    *  
    *  And remove line 63
    */

    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {2}"));
    plot.setOutlinePaint(Color.white);

    _chart = chart;
}

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

/**
 * Creates a 3D pie chart.// w  ww .  j a va  2  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:Grafica.java

private void init() {
    panel = new JPanel();
    getContentPane().add(panel);/*from   w  w  w .  j  a  va2  s.  c  o  m*/
    // Fuente de Datos
    DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
    defaultpiedataset.setValue("Abiertas 81%", new Double(81D));
    defaultpiedataset.setValue("Cerradas 19%", new Double(19D));
    //        defaultpiedataset.setValue("Hacking", new Double(19.5D));
    //        defaultpiedataset.setValue("SEO", new Double(30.5D));
    //        defaultpiedataset.setValue("Redes", new Double(2.0D));

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createPieChart3D("Informe De Asignacin De Clases", defaultpiedataset,
            true, true, false);
    PiePlot3D pieplot3d = (PiePlot3D) chart.getPlot();
    pieplot3d.setDepthFactor(0.5);
    pieplot3d.setStartAngle(290D);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setForegroundAlpha(0.5F);

    // Mostrar Grafico
    ChartPanel chartPanel = new ChartPanel(chart);
    panel.add(chartPanel);
}

From source file:edu.coeia.charts.PieChartPanel.java

private static JFreeChart createChart(final PieDataset dataset, String str) {
    final JFreeChart chart = ChartFactory.createPieChart3D(str, // chart title
            dataset, // data
            true, // include legend
            true, false);/*from w w  w.jav  a2s  . c om*/

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

From source file:de.berlios.statcvs.xml.chart.AbstractPieChart.java

/**
 * @param filename// w w w  . j  av  a 2 s. c om
 * @param title
 */
public AbstractPieChart(ReportSettings settings, String filename, String title) {
    super(settings, filename, title);

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

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    //plot.setDepthFactor(0.2);
    plot.setDepthFactor(0.01);

    setChart(chart);
}

From source file:com.codeandme.jfreechart.DemoView.java

private org.jfree.chart.JFreeChart createChart(final PieDataset dataset, final String title) {
    final JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false);
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);//from  w  ww  .  j a  v a2 s  .c o m
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return chart;
}