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:org.sipfoundry.sipxconfig.site.cdr.CdrReports.java

private static Image createExtensionsChartImage(List<CdrGraphBean> extensions, String xAxisLabel,
        String yAxisLabel) {//  w  w  w  .j  a v a  2s.  c o  m
    // Create a dataset...
    DefaultCategoryDataset data = new DefaultCategoryDataset();

    // Fill dataset with beans data
    for (CdrGraphBean extension : extensions) {
        data.setValue(extension.getCount(), extension.getKey(), extension.getKey());
    }

    // Create a chart with the dataset
    JFreeChart barChart = ChartFactory.createBarChart3D(EMPTY_TITLE, xAxisLabel, yAxisLabel, data,
            PlotOrientation.VERTICAL, true, true, true);
    barChart.setBackgroundPaint(Color.lightGray);
    barChart.getTitle().setPaint(Color.BLACK);
    CategoryPlot p = barChart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Create and return the image with the size specified in the XML design
    return barChart.createBufferedImage(500, 220, BufferedImage.TYPE_INT_RGB, null);
}

From source file:net.sf.jasperreports.chartthemes.spring.GenericChartTheme.java

protected JFreeChart createBar3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createBarChart3D(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()),
            evaluateTextExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(),
            true, false);// www .  ja  v a 2 s.  com

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot) getPlot();

    BarRenderer3D barRenderer3D = new BarRenderer3D(
            bar3DPlot.getXOffsetDouble() == null ? BarRenderer3D.DEFAULT_X_OFFSET
                    : bar3DPlot.getXOffsetDouble(),
            bar3DPlot.getYOffsetDouble() == null ? BarRenderer3D.DEFAULT_Y_OFFSET
                    : bar3DPlot.getYOffsetDouble());

    boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels();
    barRenderer3D.setBaseItemLabelsVisible(isShowLabels);
    if (isShowLabels) {
        JRItemLabel itemLabel = bar3DPlot.getItemLabel();
        Integer baseFontSize = (Integer) getDefaultValue(defaultChartPropertiesMap,
                ChartThemesConstants.BASEFONT_SIZE);
        JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont() : null;
        barRenderer3D.setBaseItemLabelFont(getFont(new JRBaseFont(getChart(), null), font, baseFontSize));

        if (itemLabel != null) {
            if (itemLabel.getColor() != null) {
                barRenderer3D.setBaseItemLabelPaint(itemLabel.getColor());
            } else {
                barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
            }
            //            categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor());
            //            if (itemLabel.getMask() != null)
            //            {
            //               barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            //                     StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, 
            //                     new DecimalFormat(itemLabel.getMask())));
            //            }
            //            else
            //            {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            //            }
        } else {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
        }
    }

    categoryPlot.setRenderer(barRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
            bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
            bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
            bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(), false,
            (Comparable<?>) evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
            bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
            bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
            bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(), true,
            (Comparable<?>) evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:hudson.plugins.plot.PlotData.java

/**
 * Creates a Chart of the style indicated by getEffStyle() using the given dataset.
 * Defaults to using createLineChart.//  ww w . j  a  va2  s .  c o  m
 */
private JFreeChart createChart(PlotCategoryDataset dataset) {
    String s = getUrlStyle();
    if (s.equalsIgnoreCase("area")) {
        return ChartFactory.createAreaChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
                PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("bar")) {
        return ChartFactory.createBarChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
                PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("bar3d")) {
        return ChartFactory.createBarChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
                PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("line3d")) {
        return ChartFactory.createLineChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
                PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("stackedarea")) {
        return ChartFactory.createStackedAreaChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(),
                dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("stackedbar")) {
        return ChartFactory.createStackedBarChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(),
                dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("stackedbar3d")) {
        return ChartFactory.createStackedBarChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(),
                dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    if (s.equalsIgnoreCase("waterfall")) {
        return ChartFactory.createWaterfallChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
                PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
    }
    return ChartFactory.createLineChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset,
            PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false);
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createBar3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createBarChart3D(
            (String) evaluateExpression(getChart().getTitleExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()),
            (String) evaluateExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientation(), isShowLegend(), true, false);

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot) getPlot();

    BarRenderer3D barRenderer3D = new BarRenderer3D(
            bar3DPlot.getXOffsetDouble() == null ? BarRenderer3D.DEFAULT_X_OFFSET
                    : bar3DPlot.getXOffsetDouble().doubleValue(),
            bar3DPlot.getYOffsetDouble() == null ? BarRenderer3D.DEFAULT_Y_OFFSET
                    : bar3DPlot.getYOffsetDouble().doubleValue());

    boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels().booleanValue();
    barRenderer3D.setBaseItemLabelsVisible(isShowLabels);
    if (isShowLabels) {
        JRItemLabel itemLabel = bar3DPlot.getItemLabel();
        JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont()
                : new JRBaseFont(getChart(), null);
        barRenderer3D.setBaseItemLabelFont(JRFontUtil.getAwtFont(font, getLocale()));
        if (itemLabel != null) {
            if (itemLabel.getColor() != null) {
                barRenderer3D.setBaseItemLabelPaint(itemLabel.getColor());
            } else {
                barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
            }/*from   w  ww .j a va  2s. c o m*/
            //            categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor());
            //            if(itemLabel.getMask() != null)
            //            {
            //               barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            //                     StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, 
            //                     new DecimalFormat(itemLabel.getMask())));
            //            }
            //            else
            //            {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            //            }
        } else {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
        }
    }

    categoryPlot.setRenderer(barRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
            bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
            bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
            bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
            bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
            bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
            bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(), (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
            (Comparable) evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:UserInterface.FinanceRole.TransferToRegSiteJPanel.java

private void populateTransactionTable(RegisteredSiteEnterprise objRegisteredSiteEnterprise) {

    //Chart        
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    //Table/*from   w  ww  .  j a v a2s.  c  o  m*/
    DefaultTableModel dtm = (DefaultTableModel) transationHistoryJTable.getModel();
    dtm.setRowCount(0);

    if (objRegisteredSiteEnterprise != null) {
        for (Transaction objTransaction : objRegisteredSiteEnterprise.getObjTransactionDirectory()
                .getTransactionList()) {

            if (objTransaction.getTransactionSource()
                    .equals(Transaction.TransactionSourceType.FromWorldEnterprise.getValue())) {

                Object row[] = new Object[3];
                row[0] = objTransaction;
                row[1] = "$ " + objTransaction.getTransactionBDAmount();
                row[2] = objTransaction.getTransactionDateToDisplay();

                dtm.addRow(row);

                dataSet.setValue(objTransaction.getTransactionBDAmount(), "Amount",
                        objTransaction.getTransactionDateToDisplay());
            }
        }

        JFreeChart chart = ChartFactory.createBarChart3D("Overview of entire Transaction", "Transaction Date",
                "Amount in USD $", dataSet, PlotOrientation.VERTICAL, false, true, false);

        CategoryPlot plot = chart.getCategoryPlot();
        plot.setRangeGridlinePaint(Color.black);

        ChartPanel myChart = new ChartPanel(chart);
        transferDetailsJPanel.setLayout(new java.awt.BorderLayout());
        transferDetailsJPanel.add(myChart, BorderLayout.CENTER);
        transferDetailsJPanel.validate();
        transferDetailsJPanel.setVisible(true);
    } else {
        transferDetailsJPanel.setVisible(false);
    }
}

From source file:org.sipfoundry.sipxconfig.site.cdr.CdrReports.java

private static Image createMinutesOutgoingCallsChartImage(List<CdrMinutesGraphBean> minutesOutgoingCalls,
        String xAxisLabel, String yAxisLabel) {
    // Create a dataset...
    DefaultCategoryDataset data = new DefaultCategoryDataset();

    // Fill dataset with beans data
    for (CdrMinutesGraphBean minutesOutgoingCall : minutesOutgoingCalls) {
        data.setValue(minutesOutgoingCall.getMinutes() / 60000, minutesOutgoingCall.getExtension(),
                minutesOutgoingCall.getExtension());
    }// www . ja va2s  .  c  o m

    // Create a chart with the dataset
    JFreeChart barChart = ChartFactory.createBarChart3D(EMPTY_TITLE, xAxisLabel, yAxisLabel, data,
            PlotOrientation.VERTICAL, true, true, true);
    barChart.setBackgroundPaint(Color.lightGray);
    barChart.getTitle().setPaint(Color.BLACK);
    CategoryPlot p = barChart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.red);

    // Create and return the image with the size specified in the XML design
    return barChart.createBufferedImage(500, 220, BufferedImage.TYPE_INT_RGB, null);
}

From source file:stockit.ClientFrame.java

private void createChart() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    int row = StockInfoTable.getSelectedRow();
    if (row != -1) {
        //dataset.setValue(, "", table.getValueAt(0,1).toString());
        String selectedStock = StockInfoTable.getValueAt(row, 0).toString();
        try {/*from w w w. j a  v  a  2 s  .c o m*/
            DBConnection dbcon = new DBConnection();
            dbcon.establishConnection();
            Statement stmt = dbcon.con.createStatement();
            ResultSet rs = stmt
                    .executeQuery("Select stock_daily_performance.Closing_Price, stock_daily_performance.Date\n"
                            + "FROM stock_daily_performance, stock\n"
                            + "WHERE stock_daily_performance.StockID = stock.StockID AND stock.StockID = '"
                            + selectedStock + "'" + "AND Date IN\n" + "( Select * from\n" + "(\n"
                            + "SELECT Date \n" + "FROM stock_daily_performance \n"
                            + "WHERE StockID = stockID \n" + "ORDER BY Date ASC\n" + ") temp_table)\n"
                            + "            ");

            while (rs.next()) {

                String formattedDate = rs.getString("Date");
                int closing_price = rs.getInt("Closing_Price");
                dataset.setValue(closing_price, "value", formattedDate);

            }
            dbcon.con.close();
        } catch (Exception ex) {
            System.out.println(ex.toString());
        }
        String stockName = StockInfoTable.getValueAt(row, 1).toString();
        JFreeChart chart = ChartFactory.createBarChart3D(stockName + " Stock Performance", "Date", "Value",
                dataset, PlotOrientation.VERTICAL, false, false, false);

        Color c = new Color(240, 240, 240, 0);
        chart.setBackgroundPaint(c);
        CategoryPlot catPlot = chart.getCategoryPlot();
        catPlot.setRangeGridlinePaint(Color.BLACK);
        //set interval of Y-axis ticks (tick every 5 units)
        NumberAxis yAxis = (NumberAxis) catPlot.getRangeAxis();
        yAxis.setTickUnit(new NumberTickUnit(5));

        //set y-axis labels as currency types ($)
        NumberFormat currency = NumberFormat.getCurrencyInstance();
        yAxis.setNumberFormatOverride(currency);

        //setting number of lines an x-axis label is displayed on
        CategoryAxis categoryAxis = catPlot.getDomainAxis();
        categoryAxis.setMaximumCategoryLabelLines(4);
        ChartContainer.setLayout(new java.awt.BorderLayout());
        ChartPanel chartPanel = new ChartPanel(chart);
        ChartContainer.removeAll();
        ChartContainer.add(chartPanel, BorderLayout.CENTER);
        ChartContainer.validate();
        ChartContainer.repaint();
    }
}

From source file:userinterface.HealthAnalystRole.ViewReportJPanel.java

private void createChart() {
    DefaultCategoryDataset healthDataset = new DefaultCategoryDataset();
    int selectedRow = tblHealthTable.getSelectedRow();
    Device effects = (Device) tblHealthTable.getValueAt(selectedRow, 0);
    //Device device= device.getEffectsOnBodyList().getEffectsOnBodyList().;

    for (Device d : organization.getDeviceDirectory().getDeviceList()) {
        if (d.getEffectsOnBodyList().getEffectsOnBodyList().isEmpty()
                || d.getEffectsOnBodyList().getEffectsOnBodyList().size() == 1) {
            JOptionPane.showMessageDialog(this,
                    "No body organs or only one body organ affected found. At least 2 organs effected records needed to show chart!",
                    "Warning", JOptionPane.INFORMATION_MESSAGE);
            return;
        } else {//ww w  .  j  av  a  2s . co  m
            Double organ = Double.parseDouble(txtOrgan.getText());
            Double value = d.getMaxSAR();
        }
    }
    //ArrayList<EffectsOnBody> effectsOnBodyList = device.getEffectsOnBodyList().getEffectsOnBodyList();

    /*if (effectsOnBodyList.isEmpty() || effectsOnBodyList.size() == 1) {
    JOptionPane.showMessageDialog(this, "No body organs or only one body organ affected found. At least 2 organs effected records needed to show chart!", "Warning", JOptionPane.INFORMATION_MESSAGE);
    return;
    }*/
    Double organ = Double.parseDouble(txtOrgan.getText());
    for (Device device : organization.getDeviceDirectory().getDeviceList()) {
        for (EffectsOnBody b1 : device.getEffectsOnBodyList().getEffectsOnBodyList()) {
            Double value = device.getMaxSAR();

            //healthDataset.addValue(vitalSign.getHeartRate(),"Most Likely Diseases", device.getMaxSAR());
            //vitalSignDataset.addValue(vitalSign.getBloodPressure(),"BP", vitalSign.getTimestamp());
            //vitalSignDataset.addValue(vitalSign.getWeight(),"WT", vitalSign.getTimestamp());
        }

    }

    JFreeChart healthSignChart = ChartFactory.createBarChart3D("Effects On Health Chart", "Time Stamp", "Rate",
            healthDataset, PlotOrientation.VERTICAL, true, false, false);
    healthSignChart.setBackgroundPaint(Color.white);
    CategoryPlot vitalSignChartPlot = healthSignChart.getCategoryPlot();
    vitalSignChartPlot.setBackgroundPaint(Color.lightGray);

    CategoryAxis vitalSignDomainAxis = vitalSignChartPlot.getDomainAxis();
    vitalSignDomainAxis
            .setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));

    NumberAxis vitalSignRangeAxis = (NumberAxis) vitalSignChartPlot.getRangeAxis();
    vitalSignRangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    ChartFrame chartFrame = new ChartFrame("Chart", healthSignChart);
    chartFrame.setVisible(true);
    chartFrame.setSize(500, 500);

}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected JFreeChart createBar3DChart() throws JRException {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart jfreeChart = ChartFactory.createBarChart3D(
            evaluateTextExpression(getChart().getTitleExpression()),
            evaluateTextExpression(((JRBar3DPlot) getPlot()).getCategoryAxisLabelExpression()),
            evaluateTextExpression(((JRBar3DPlot) getPlot()).getValueAxisLabelExpression()),
            (CategoryDataset) getDataset(), getPlot().getOrientationValue().getOrientation(), isShowLegend(),
            true, false);//from   w w  w . j av  a  2 s. c  o  m

    configureChart(jfreeChart, getPlot());

    CategoryPlot categoryPlot = (CategoryPlot) jfreeChart.getPlot();
    JRBar3DPlot bar3DPlot = (JRBar3DPlot) getPlot();

    BarRenderer3D barRenderer3D = new BarRenderer3D(
            bar3DPlot.getXOffsetDouble() == null ? BarRenderer3D.DEFAULT_X_OFFSET
                    : bar3DPlot.getXOffsetDouble(),
            bar3DPlot.getYOffsetDouble() == null ? BarRenderer3D.DEFAULT_Y_OFFSET
                    : bar3DPlot.getYOffsetDouble());

    boolean isShowLabels = bar3DPlot.getShowLabels() == null ? false : bar3DPlot.getShowLabels();
    barRenderer3D.setBaseItemLabelsVisible(isShowLabels);
    if (isShowLabels) {
        JRItemLabel itemLabel = bar3DPlot.getItemLabel();
        JRFont font = itemLabel != null && itemLabel.getFont() != null ? itemLabel.getFont()
                : new JRBaseFont(getChart(), null);
        barRenderer3D.setBaseItemLabelFont(getFontUtil().getAwtFont(font, getLocale()));
        if (itemLabel != null) {
            if (itemLabel.getColor() != null) {
                barRenderer3D.setBaseItemLabelPaint(itemLabel.getColor());
            } else {
                barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
            }
            //            categoryRenderer.setBaseFillPaint(itemLabel.getBackgroundColor());
            //            if (itemLabel.getMask() != null)
            //            {
            //               barRenderer3D.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(
            //                     StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING, 
            //                     new DecimalFormat(itemLabel.getMask())));
            //            }
            //            else
            //            {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            //            }
        } else {
            barRenderer3D.setBaseItemLabelGenerator((CategoryItemLabelGenerator) getLabelGenerator());
            barRenderer3D.setBaseItemLabelPaint(getChart().getForecolor());
        }
    }

    categoryPlot.setRenderer(barRenderer3D);

    // Handle the axis formating for the category axis
    configureAxis(categoryPlot.getDomainAxis(), bar3DPlot.getCategoryAxisLabelFont(),
            bar3DPlot.getCategoryAxisLabelColor(), bar3DPlot.getCategoryAxisTickLabelFont(),
            bar3DPlot.getCategoryAxisTickLabelColor(), bar3DPlot.getCategoryAxisTickLabelMask(),
            bar3DPlot.getCategoryAxisVerticalTickLabels(), bar3DPlot.getOwnCategoryAxisLineColor(),
            getDomainAxisSettings(),
            (Comparable<?>) evaluateExpression(bar3DPlot.getDomainAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bar3DPlot.getDomainAxisMaxValueExpression()));

    // Handle the axis formating for the value axis
    configureAxis(categoryPlot.getRangeAxis(), bar3DPlot.getValueAxisLabelFont(),
            bar3DPlot.getValueAxisLabelColor(), bar3DPlot.getValueAxisTickLabelFont(),
            bar3DPlot.getValueAxisTickLabelColor(), bar3DPlot.getValueAxisTickLabelMask(),
            bar3DPlot.getValueAxisVerticalTickLabels(), bar3DPlot.getOwnValueAxisLineColor(),
            getRangeAxisSettings(),
            (Comparable<?>) evaluateExpression(bar3DPlot.getRangeAxisMinValueExpression()),
            (Comparable<?>) evaluateExpression(bar3DPlot.getRangeAxisMaxValueExpression()));

    return jfreeChart;
}

From source file:com.smanempat.controller.ControllerClassification.java

public void showChart(JLabel jumlahSiswaIPA, JLabel jumlahSiswaIPS, JLabel labelKeterangan) {
    DefaultCategoryDataset barChartData = new DefaultCategoryDataset();
    barChartData.setValue(Integer.parseInt(jumlahSiswaIPA.getText()), "IPA", "IPA");
    barChartData.setValue(Integer.parseInt(jumlahSiswaIPS.getText()), "IPS", "IPS");
    JFreeChart barchart = ChartFactory.createBarChart3D(
            "Grafik Jumlah Siswa per Jurusan, Tahun Ajaran " + labelKeterangan.getText().substring(53, 62) + "",
            "Jurusan", "Jumlah Siswa", barChartData, PlotOrientation.VERTICAL, true, true, false);
    CategoryPlot plotBarChart = barchart.getCategoryPlot();
    ChartFrame chartFrame = new ChartFrame("Grafik Jumlah Siswa Tiap Jurusan", barchart, true);
    chartFrame.setVisible(true);/*from   www.  j  av  a 2s  .  c o  m*/
    chartFrame.setSize(700, 500);
    chartFrame.setLocationRelativeTo(null);
    plotBarChart.setRangeGridlinePaint(java.awt.Color.black);
    ChartPanel chartPanel = new ChartPanel(barchart);
}