Example usage for org.jfree.chart.renderer.category BarRenderer3D setDrawBarOutline

List of usage examples for org.jfree.chart.renderer.category BarRenderer3D setDrawBarOutline

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category BarRenderer3D setDrawBarOutline.

Prototype

public void setDrawBarOutline(boolean draw) 

Source Link

Document

Sets the flag that controls whether or not bar outlines are drawn and sends a RendererChangeEvent to all registered listeners.

Usage

From source file:graficos.GraficoBarras.java

private static JFreeChart crearGrafico(CategoryDataset cjto_datos) {
    JFreeChart grafico = ChartFactory.createBarChart3D("Distribucin de Recursos", // Ttulo
            "Unidad de tiempo", // Ttulo eje x
            "Recurso", // Ttulo eje y
            cjto_datos, // Datos
            PlotOrientation.VERTICAL, // Orientacin
            true, // Incluir leyenda
            true, // Incluir tooltips
            false // Incluir URLs
    );/*w  w  w  .  j a  v  a2  s  .  co  m*/
    grafico.setBackgroundPaint(new Color(240, 240, 240));
    grafico.getPlot().zoom(0.0);
    CategoryPlot ploter = (CategoryPlot) grafico.getPlot();
    NumberAxis3D rangeAxis = (NumberAxis3D) ploter.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis3D.createIntegerTickUnits());
    BarRenderer3D renderer = (BarRenderer3D) ploter.getRenderer();
    renderer.setDrawBarOutline(false);
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setItemMargin(0.0);
    CategoryAxis domainAxis = ploter.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(0.0));
    return grafico;
}

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

/**
 * Cre le graphique//from w w w  . java  2 s. c  o m
 *
 * @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:fuel.gui.stats.BarChartPanel.java

public BarChartPanel(DefaultCategoryDataset barDataset, String message, boolean stacked) {
    JFreeChart barChart;//ww  w  .  j a  v a 2 s .  c  o m
    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:org.sonar.plugins.abacus.chart.BarChart3D.java

private void configureRenderer(CategoryPlot plot) {
    BarRenderer3D renderer = new BarRenderer3D();
    renderer.setDrawBarOutline(true);
    renderer.setSeriesItemLabelsVisible(0, true);
    renderer.setItemMargin(0);//from  w  w w.j  a va2  s.com
    plot.setRenderer(renderer);
}

From source file:j2se.jfreechart.barchart.BarChart3DDemo1.java

/**
 * Creates a chart./*from   w w  w. j av a  2  s  .  com*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createBarChart3D("3D Bar Chart Demo", // chart title
            "Category", // domain axis label
            "Value", // 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:unikn.dbis.univis.visualization.chart.BarChart.java

/**
 * starts the Bar3DChart.//  ww  w .  java2 s .co  m
 */
public void plot() {
    CategoryPlot plot = (CategoryPlot) getChart().getPlot();
    CategoryAxis axis = plot.getDomainAxis();
    axis.setTickLabelsVisible(false);
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setLegendItemLabelGenerator(new LabelGenerator(createTotal()));
    plot.setNoDataMessage("No data available");
    plot.getDomainAxis().setLabelFont(getLegendFont());
    plot.getRangeAxis().setLabelFont(getLegendFont());
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
}

From source file:org.eevolution.form.CRPDetail.java

/**
 * Create Chart based on UOM/*  w  ww.  ja  v  a  2  s  .  c  o m*/
 * 
 * @param dataset
 * @param title
 * @param uom
 * @return JFreeChart Chart based On UOM
 */
public JFreeChart createChart(CategoryDataset dataset, String title, MUOM uom) {

    JFreeChart chart = ChartFactory.createBarChart3D(title, Msg.translate(Env.getCtx(), "Day"), // X-Axis label
            Msg.translate(Env.getCtx(), (uom == null) ? "" : uom.getName()), // Y-Axis
            // label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips?
            false // URLs?
    );

    chart.setBackgroundPaint(Color.WHITE);
    chart.setAntiAlias(true);
    chart.setBorderVisible(true);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.GRAY);

    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.GRAY);

    BarRenderer3D barrenderer = (BarRenderer3D) plot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    barrenderer.setBaseItemLabelGenerator(new LabelGenerator());
    barrenderer.setBaseItemLabelsVisible(true);
    barrenderer.setSeriesPaint(0, new Color(10, 80, 150, 128));
    barrenderer.setSeriesPaint(1, new Color(180, 60, 50, 128));

    ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
            TextAnchor.TOP_CENTER);
    barrenderer.setPositiveItemLabelPosition(itemlabelposition);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    return chart;
}

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

private void refreshGraphs() {
    graphContainer.removeAll();//  www. ja  v a2s.com
    DefaultPieDataset usageDataset = new DefaultPieDataset();
    try {
        for (Station station : database.getStations()) {
            ResultSet thisStation = database
                    .Query("SELECT SUM(liter) FROM fuelrecords WHERE stationId = " + station.getId(), true);
            thisStation.next();
            usageDataset.setValue(station.toString(), thisStation.getInt("1"));
        }

    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex.getMessage() + ex.getCause());
    }
    JFreeChart usagePieChart = ChartFactory.createPieChart3D("", usageDataset, true, true, false);
    PiePlot3D plot3 = (PiePlot3D) usagePieChart.getPlot();
    plot3.setForegroundAlpha(0.6f);
    //plot3.setCircular(true);

    JPanel usagePieChartPanel = new ChartPanel(usagePieChart);
    usagePieChartPanel.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createTitledBorder("Tankstation verhouding")));
    usagePieChartPanel.setPreferredSize(new java.awt.Dimension(320, 240));

    DefaultPieDataset fuelDataset = new DefaultPieDataset();
    try {
        ResultSet numberResults = database.Query("SELECT DISTINCT typeOfGas FROM fuelrecords", true);
        while (numberResults.next()) {
            ResultSet thisStation = database.Query("SELECT SUM(liter) FROM fuelrecords WHERE typeOfGas = '"
                    + numberResults.getString("typeOfGas") + "'", true);
            thisStation.next();
            fuelDataset.setValue(numberResults.getString("typeOfGas"), thisStation.getInt("1"));
        }

    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex.getMessage() + ex.getCause());
    }
    JFreeChart fuelPieChart = ChartFactory.createPieChart3D("", fuelDataset, true, true, false);
    PiePlot3D plot2 = (PiePlot3D) fuelPieChart.getPlot();
    plot2.setForegroundAlpha(0.6f);
    //plot3.setCircular(true);

    JPanel fuelPieChartPanel = new ChartPanel(fuelPieChart);
    fuelPieChartPanel.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createTitledBorder("Brandstof verhouding")));
    fuelPieChartPanel.setPreferredSize(new java.awt.Dimension(320, 240));

    DefaultCategoryDataset barDataset = new DefaultCategoryDataset();
    try {
        ResultSet motorThing = database.Query("SELECT cost/liter,date FROM fuelrecords ORDER BY date ASC",
                true);
        while (motorThing.next()) {
            barDataset.addValue(motorThing.getDouble("1"), motorThing.getString("date"), "Prijs per liter");
        }

    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex.getMessage() + ex.getCause());
    }

    JFreeChart barChart = ChartFactory.createBarChart3D("", // chart title
            "", // domain axis label
            "Aantal", // range axis label
            barDataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips?
            false // URLs?
    );
    CategoryPlot plot = barChart.getCategoryPlot();
    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    ChartPanel barChartPanel = new ChartPanel(barChart);
    barChartPanel.getChartRenderingInfo().setEntityCollection(null);
    barChartPanel.setBorder(BorderFactory.createTitledBorder("Prijs per liter"));
    barChartPanel.setPreferredSize(new java.awt.Dimension(320, 240));

    JPanel piePanel = new JPanel(new GridLayout(0, 2));
    piePanel.add(usagePieChartPanel);
    piePanel.add(fuelPieChartPanel);
    graphContainer.add(piePanel);
    graphContainer.add(barChartPanel);
    revalidate();
    repaint();
}

From source file:org.gvsig.symbology.fmap.symbols.BarChart3DSymbol.java

protected Plot getMapPlot() {
    mapPlot = null; // <- delete this
    if (mapPlot == null) {
        CategoryPlot myMapPlot = new CategoryPlot();
        try {//from  w w  w .  j a va 2 s.  c om
            myMapPlot = (CategoryPlot) getOutlinePlot().clone();
        } catch (CloneNotSupportedException e) {
            Logger.getLogger(getClass()).error("Error cloning the BarChart3DSymbol's plot, check consistency");
            myMapPlot = new CategoryPlot();
        }

        myMapPlot.setBackgroundPaint(null);
        myMapPlot.setOutlinePaint(null);
        BarRenderer3D renderer = (BarRenderer3D) myMapPlot.getRenderer();
        renderer.setDrawBarOutline(drawBarOutline);
        // renderer.setBaseItemLabelsVisible(false, false);
        // renderer.setBaseSeriesVisible(false, false);
        renderer.setBaseSeriesVisibleInLegend(false);

        // myMapPlot.setBackgroundImage(null);

        mapPlot = myMapPlot;
    }
    return mapPlot;
}

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

/**
 * Creates a 3D bar chart.//from w  w  w  .j  a v a 2s. c  o m
 * 
 * @param dataset  the category dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

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

    setCategorySummary(dataset);
    return chart;

}