Example usage for org.jfree.chart ChartFactory createBarChart3D

List of usage examples for org.jfree.chart ChartFactory createBarChart3D

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory createBarChart3D.

Prototype

public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) 

Source Link

Document

Creates a bar chart with a 3D effect.

Usage

From source file:com.jtk.pengelolaanujian.view.dashboard.PipePanelSample.java

private ChartPanel createChart(DefaultCategoryDataset data) {
    barchart = ChartFactory.createBarChart3D("Data Keterlambatan pengelolaan Soal Ujian", "Aktifitas",
            "Jumlah Keterlambatan", data, PlotOrientation.VERTICAL, true, true, false);
    barchart.setBackgroundPaint(new Color(135, 206, 250));
    CategoryPlot plot = (CategoryPlot) barchart.getPlot();
    plot.setNoDataMessage("Data Tidak ada");
    CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setBaseItemLabelsVisible(true);
    BarRenderer barRenderer = (BarRenderer) renderer;
    barRenderer.setItemMargin(0.1D);/*from www.  j  av  a 2 s .c  o m*/
    barRenderer.setDrawBarOutline(true);
    return new ChartPanel(barchart);
}

From source file:net.sourceforge.processdash.ui.web.reports.BarChart.java

/** Create a bar chart. */
public JFreeChart createChart() {
    //if (data.numCols() == 1) data = data.transpose();
    JFreeChart chart;/*  w ww.  ja va  2 s .com*/
    boolean vertical = true; // default
    String direction = getParameter("dir");
    if ((direction != null && direction.toLowerCase().startsWith("hor"))
            || parameters.get("horizontal") != null)
        vertical = false;
    chart = ChartFactory.createBarChart3D(null, null, null, data.catDataSource(),
            (vertical ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL), true, true, false);

    setupCategoryChart(chart);

    return chart;
}

From source file:net.sf.statcvs.output.xml.chart.AbstractBarChart.java

/**
 * // www.j  av  a2  s.co m
 */
private void createChart() {
    // create the chart...
    JFreeChart chart = ChartFactory.createBarChart3D(Settings.getProjectName(), // chart title
            "no desc", // domain axis label
            "no desc", // range axis label
            dataset, // data
            PlotOrientation.HORIZONTAL, true, // include legend
            true, // tooltips
            false // urls
    );
    setChart(chart);
    //placeTitle();      
}

From source file:GUI.GraficaView.java

private void init() {
    ArrayList<OperacionesDiarias> aux = operario.getArrayOperacionesDiarias();
    Collections.sort(aux);/*  w  w  w.  java2s. com*/

    panel = new JPanel();
    getContentPane().add(panel);
    // Fuente de Datos
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    for (OperacionesDiarias op : aux) {
        if (op.getListaOperaciones().size() > 0) {
            dataset.setValue(op.getPorcentaje(), operario.getNombre(), op.getFecha());
        }

    }

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createBarChart3D("Rendimiento", "Dia", "Porcentaje %", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    chart.setBackgroundPaint(Color.LIGHT_GRAY);
    chart.getTitle().setPaint(Color.black);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

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

From source file:edu.esprit.pi.workshop.statistiques.BarChart.java

@Override
public JFreeChart construireChart3D() {
    graphe = ChartFactory.createBarChart3D("Pourcentage revenue par Dpartement", "", "Pourcentage du revenu",
            createDataset(), PlotOrientation.HORIZONTAL, true, true, true);
    final CategoryPlot plot = graphe.getCategoryPlot();
    final CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0));
    final CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setItemLabelsVisible(true);
    return graphe;
}

From source file:app.view.panel.PanelHistogramme.java

/**
 * Cre le graphique/*from   w  w  w.java  2  s  . com*/
 *
 * @param dataset Echantillon de donnes
 * @return Graphique
 */
private JFreeChart createChart(CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createBarChart3D("Sries de bac", // chart title
            "Bacs", // domain axis label
            "Nombre", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    final CategoryPlot plot = chart.getCategoryPlot();
    final CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0));
    final BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    return chart;
}

From source file:com.rapidminer.gui.plotter.charts.BarChart3DPlotter.java

public JFreeChart createChart(CategoryDataset categoryDataSet, String groupByName, String valueName,
        boolean createLegend) {

    JFreeChart chart = ChartFactory.createBarChart3D(null, // chart title
            groupByName, // domain axis label
            valueName, // range axis label
            categoryDataSet, // data
            PlotOrientation.VERTICAL, // orientation
            ((createLegend) && (groupByName != null)), // include legend if group by column is set
            true, // tooltips
            false // URLs
    );//from  w  w w. ja v  a 2 s.  co m

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(new Color(230, 230, 230));
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    // set up paints for series
    if (groupByName == null) {
        BarRenderer renderer = (BarRenderer) plot.getRenderer();
        renderer.setSeriesPaint(0, SwingTools.LIGHT_BLUE);
        renderer.setSeriesPaint(1, SwingTools.LIGHT_YELLOW);
    }

    // domain axis labels
    CategoryAxis domainAxis = plot.getDomainAxis();
    if (groupByName == null) {
        domainAxis.setTickLabelsVisible(true);
        domainAxis.setCategoryLabelPositions(
                CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    } else {
        domainAxis.setTickLabelsVisible(false);
    }

    return chart;
}

From source file:fuel.gui.stats.BarChartPanel.java

public BarChartPanel(DefaultCategoryDataset barDataset, String message, boolean stacked) {
    JFreeChart barChart;//  w w  w .  j  av  a2 s  .  com
    if (stacked) {
        barChart = ChartFactory.createStackedBarChart3D("", // chart title
                "", // domain axis label
                "", // range axis label
                barDataset, // data
                PlotOrientation.VERTICAL, true, // include legend
                true, // tooltips?
                true // URLs?
        );
    } else {
        barChart = ChartFactory.createBarChart3D("", // chart title
                "", // domain axis label
                "", // range axis label
                barDataset, // data
                PlotOrientation.VERTICAL, false, // include legend
                true, // tooltips?
                true // URLs?
        );
    }
    CategoryPlot plot = barChart.getCategoryPlot();
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    final CategoryAxis domainAxis = plot.getDomainAxis();
    double count = barDataset.getColumnCount();
    double extra = 16 / count;
    domainAxis.setCategoryLabelPositions(
            CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / (2 + extra)));

    ChartPanel barChartPanel = new ChartPanel(barChart);
    barChartPanel.getChartRenderingInfo().setEntityCollection(null);
    barChartPanel.setBorder(BorderFactory.createTitledBorder(message));
    int wider = barDataset.getColumnCount() * 12;
    barChartPanel.setPreferredSize(new java.awt.Dimension(192 + wider, 240));
    barChartPanel.setLayout(new BorderLayout());
    setLayout(new BorderLayout());
    add(barChartPanel);
}

From source file:ANNFileDetect.GraphingClass.java

public JFreeChart chartOutcome(HashMap hm) {
    JFreeChart jf = null;//from   w  w w .  j  a va2  s  . com
    DefaultCategoryDataset dc = new DefaultCategoryDataset();
    String xax = "File Type";
    Iterator it = hm.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        dc.addValue((Double) pair.getValue(), xax, pair.getKey().toString());
    }
    jf = ChartFactory.createBarChart3D("File detection results", "File type", "Score", (CategoryDataset) dc,
            PlotOrientation.VERTICAL, true, true, true);
    return jf;
}

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

private static JFreeChart createChart(CategoryDataset categorydataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart3D("Student Grades", "Students", "Grade",
            categorydataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    CustomBarRenderer3D custombarrenderer3d = new CustomBarRenderer3D();
    custombarrenderer3d.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    custombarrenderer3d.setBaseItemLabelsVisible(true);
    custombarrenderer3d.setItemLabelAnchorOffset(10D);
    custombarrenderer3d.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
    categoryplot.setRenderer(custombarrenderer3d);
    ValueMarker valuemarker = new ValueMarker(0.69999999999999996D, new Color(200, 200, 255),
            new BasicStroke(1.0F), new Color(200, 200, 255), new BasicStroke(1.0F), 1.0F);
    categoryplot.addRangeMarker(valuemarker, Layer.BACKGROUND);
    custombarrenderer3d.setBaseItemLabelsVisible(true);
    custombarrenderer3d.setMaximumBarWidth(0.050000000000000003D);
    CategoryTextAnnotation categorytextannotation = new CategoryTextAnnotation("Minimum grade to pass",
            "Robert", 0.70999999999999996D);
    categorytextannotation.setCategoryAnchor(CategoryAnchor.START);
    categorytextannotation.setFont(new Font("SansSerif", 0, 12));
    categorytextannotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
    categoryplot.addAnnotation(categorytextannotation);
    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());
    numberaxis.setUpperMargin(0.10000000000000001D);
    return jfreechart;
}