Example usage for org.jfree.chart JFreeChart getCategoryPlot

List of usage examples for org.jfree.chart JFreeChart getCategoryPlot

Introduction

In this page you can find the example usage for org.jfree.chart JFreeChart getCategoryPlot.

Prototype

public CategoryPlot getCategoryPlot() 

Source Link

Document

Returns the plot cast as a CategoryPlot .

Usage

From source file:com.att.aro.ui.view.overviewtab.FileTypesChartPanel.java

private JFreeChart initializeChart() {
    JFreeChart chart = ChartFactory.createBarChart(
            ResourceBundleHelper.getMessageString("chart.filetype.title"), null,
            ResourceBundleHelper.getMessageString("simple.percent"), null, PlotOrientation.HORIZONTAL, false,
            false, false);// ww  w.j  a v a  2  s  .  c o m

    //chart.setBackgroundPaint(fileTypePanel.getBackground());
    chart.setBackgroundPaint(this.getBackground());
    chart.getTitle().setFont(AROUIManager.HEADER_FONT);

    this.cPlot = chart.getCategoryPlot();
    cPlot.setBackgroundPaint(Color.white);
    cPlot.setDomainGridlinePaint(Color.gray);
    cPlot.setRangeGridlinePaint(Color.gray);
    cPlot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

    CategoryAxis domainAxis = cPlot.getDomainAxis();
    domainAxis.setMaximumCategoryLabelWidthRatio(.5f);
    domainAxis.setLabelFont(AROUIManager.LABEL_FONT);
    domainAxis.setTickLabelFont(AROUIManager.LABEL_FONT);

    NumberAxis rangeAxis = (NumberAxis) cPlot.getRangeAxis();
    rangeAxis.setRange(0.0, 100.0);
    rangeAxis.setTickUnit(new NumberTickUnit(10));
    rangeAxis.setLabelFont(AROUIManager.LABEL_FONT);
    rangeAxis.setTickLabelFont(AROUIManager.LABEL_FONT);

    BarRenderer renderer = new StackedBarRenderer();
    renderer.setBasePaint(AROUIManager.CHART_BAR_COLOR);
    renderer.setAutoPopulateSeriesPaint(false);
    renderer.setBaseItemLabelGenerator(new PercentLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelPaint(Color.black);

    // Make second bar in stack invisible
    renderer.setSeriesItemLabelsVisible(1, false);
    renderer.setSeriesPaint(1, new Color(0, 0, 0, 0));

    renderer.setBaseToolTipGenerator(new CategoryToolTipGenerator() {
        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {

            FileTypeSummary summary = fileTypeContent.get(column);

            return MessageFormat.format(ResourceBundleHelper.getMessageString("chart.filetype.tooltip"),
                    NumberFormat.getIntegerInstance().format(summary.getBytes()));
        }
    });

    ItemLabelPosition insideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.INSIDE3,
            TextAnchor.CENTER_RIGHT);
    renderer.setBasePositiveItemLabelPosition(insideItemlabelposition);

    ItemLabelPosition outsideItemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
            TextAnchor.CENTER_LEFT);
    renderer.setPositiveItemLabelPositionFallback(outsideItemlabelposition);

    BarPainter painter = new StandardBarPainter();
    renderer.setBarPainter(painter);
    renderer.setShadowVisible(false);
    renderer.setMaximumBarWidth(0.1);

    cPlot.setRenderer(renderer);
    cPlot.getDomainAxis().setMaximumCategoryLabelLines(2);

    return chart;
}

From source file:Statement.Statement.java

private void barchart() {

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(rev, "Values", "Revenue");
    dataset.setValue(cost, "Values", "Cost");
    dataset.setValue(profit, "Values", "Profit");

    JFreeChart chart = ChartFactory.createBarChart3D("Statement", "", "VND", dataset, PlotOrientation.VERTICAL,
            false, false, false);/*  w  ww  . j  ava  2s . c  o m*/
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.blue);
    ChartPanel chartpanel = new ChartPanel(chart);
    pnChart.setPreferredSize(new Dimension(340, 275));
    pnChart.removeAll();
    pnChart.add(chartpanel, BorderLayout.CENTER);
    pnChart.validate();
}

From source file:org.owasp.jbrofuzz.graph.canvas.ResponseHeaderSizeChart.java

public ChartPanel getPlotCanvas() {

    final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Response Header Size Bar Chart", // chart title
            "File Name", // domain axis label
            "Response Header Size (bytes)", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips?
            true // URLs?
    );/*  w w w . ja  va2  s  . com*/

    final Plot plot = chart.getPlot();
    plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage());
    plot.setBackgroundImageAlignment(Align.TOP_RIGHT);

    final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer();
    renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

    return new ChartPanel(chart);

}

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  ww w  .  j  a  v  a2s.  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.StateNetworkAdminRole.StateReportsJPanel.java

private JFreeChart createpatientDonorReportsChart(CategoryDataset dataset) {
    JFreeChart barChart = ChartFactory.createBarChart("Patients:Donor in the state", "Year",
            "Number of Donors/Patients", dataset, PlotOrientation.VERTICAL, true, true, false);

    barChart.setBackgroundPaint(Color.white);
    // Set the background color of the chart
    barChart.getTitle().setPaint(Color.DARK_GRAY);
    barChart.setBorderVisible(true);//from   w  w  w .  ja va 2 s. c om
    // Adjust the color of the title
    CategoryPlot plot = barChart.getCategoryPlot();
    plot.getRangeAxis().setLowerBound(0.0);
    // Get the Plot object for a bar graph
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.blue);
    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.decode("#00008B"));
    //return chart;
    return barChart;
}

From source file:org.zaproxy.zap.extension.multiFuzz.impl.http.HttpFuzzResultDialog.java

public void redrawDiagrams() {
    diagrams.removeAll();/*from w ww .jav  a2s .co m*/
    JFreeChart resultChart = ChartFactory.createPieChart(
            Constant.messages.getString("fuzz.result.dia.chart.results.header"), resultSet, true, true, false);

    resultChart.getPlot().setBackgroundImageAlignment(Align.TOP_RIGHT);
    result = new ChartPanel(resultChart);

    JFreeChart statusChart = ChartFactory.createPieChart(
            Constant.messages.getString("fuzz.result.dia.chart.states.header"), stateSet, true, true, false);
    statusChart.getPlot().setBackgroundImageAlignment(Align.TOP_RIGHT);
    status = new ChartPanel(statusChart);

    JFreeChart sizeChart = ChartFactory.createBarChart(
            Constant.messages.getString("fuzz.result.dia.chart.size.header"),
            Constant.messages.getString("fuzz.result.dia.chart.size.xaxis"),
            Constant.messages.getString("fuzz.result.dia.chart.size.yaxis"), sizeSet, PlotOrientation.VERTICAL,
            false, true, true);
    sizeChart.getPlot().setBackgroundImageAlignment(Align.TOP_RIGHT);
    sizeChart.getCategoryPlot().getRenderer().setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    size = new ChartPanel(sizeChart);

    JFreeChart rttChart = ChartFactory.createBarChart(
            Constant.messages.getString("fuzz.result.dia.chart.rtt.header"),
            Constant.messages.getString("fuzz.result.dia.chart.rtt.xaxis"),
            Constant.messages.getString("fuzz.result.dia.chart.rtt.yaxis"), rttSet, PlotOrientation.VERTICAL,
            false, true, true);
    rttChart.getPlot().setBackgroundImageAlignment(Align.TOP_RIGHT);
    rttChart.getCategoryPlot().getRenderer().setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());

    rtt = new ChartPanel(rttChart);
    diagrams.add(Constant.messages.getString("fuzz.result.dia.results"), result);
    diagrams.add(Constant.messages.getString("fuzz.result.dia.states"), status);
    diagrams.add(Constant.messages.getString("fuzz.result.dia.size"), size);
    diagrams.add(Constant.messages.getString("fuzz.result.dia.rtt"), rtt);
}

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);/* w w w.  java 2 s.c  o m*/
    chartFrame.setSize(700, 500);
    chartFrame.setLocationRelativeTo(null);
    plotBarChart.setRangeGridlinePaint(java.awt.Color.black);
    ChartPanel chartPanel = new ChartPanel(barchart);
}

From source file:UserInterface.TMAnalystRole.TMAnaylstWorkAreaJPanel.java

private void btnRouteAnalysisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRouteAnalysisActionPerformed
    // TODO add your handling code here:
    Line selectedLine = (Line) cboActiveLines.getSelectedItem();
    ArrayList<Route> routeList = new ArrayList<>();

    for (Segment s : selectedLine.getSegments()) {
        routeList.add(s.getRoutes().get(0));
    }/*from  w w  w. j  ava 2 s . c  om*/

    ArrayList<Segment> segmentList = selectedLine.getSegments();
    for (int i = segmentList.size() - 1; i >= 0; i--) {
        routeList.add(segmentList.get(i).getRoutes().get(1));
    }

    int days = (int) spnrRecord.getValue();
    Date today = new Date();
    Date olderThanToday = new Date();
    olderThanToday.setTime(today.getTime() + (long) (-days) * 1000 * 60 * 60 * 24);
    long todayDate = (today.getTime()) / (1000 * 60 * 60 * 24);
    long olderDate = (olderThanToday.getTime()) / (1000 * 60 * 60 * 24);

    Map<Route, Integer> routesWithCapacityList = new LinkedHashMap<>();

    for (Route r : routeList) {
        int routeCount = 0;

        for (TimeSlot.TimeSlotRange ts : TimeSlot.TimeSlotRange.values()) {
            Train selectedTrain = r.fetchRouteSchedule(ts).getTrainOffered();
            int intermediateCount = 0;
            int trainsFound = 0;
            for (TrainOffered selectedTrainOffered : enterprise.getTrainsOfferedHistory().getTrainsOffered()) {
                if (selectedTrainOffered.getTrain().equals(selectedTrain)) {
                    long selectedDate = (selectedTrainOffered.getDayOffered().getTime())
                            / (1000 * 60 * 60 * 24);
                    if (selectedDate >= olderDate && selectedDate <= todayDate) {
                        intermediateCount += selectedTrainOffered.fetchRunningTrainByTimeSlot(ts)
                                .getRunningCapacity();
                        trainsFound++;
                    }
                }

            }
            if (trainsFound != 0) {
                intermediateCount = intermediateCount / trainsFound;
                routeCount += intermediateCount;
            }
        }
        routeCount = Math.round(routeCount / 15);
        routesWithCapacityList.putIfAbsent(r, routeCount);
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    for (Map.Entry<Route, Integer> entry : routesWithCapacityList.entrySet()) {
        dataset.setValue(entry.getValue(), "Routes", entry.getKey().getRouteName());

    }

    JFreeChart chart = ChartFactory.createBarChart(
            "Congestion Levels of Line : " + selectedLine.getLineName() + " for " + days + " days", "Routes",
            "Average Congestion Levels", dataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLUE);
    ChartFrame frame = new ChartFrame("Bar Chart for Congestion Analysis", chart);
    frame.setVisible(true);
    frame.setSize(this.getWidth(), this.getHeight() + 200);

}

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

private void refreshGraphs(Motorcycle motor) {
    graphContainer.removeAll();//from  ww  w.j av a 2  s .  co  m
    if (motor != null) {
        DefaultPieDataset usageDataset = new DefaultPieDataset();
        try {
            ResultSet thisMotor = database
                    .Query("SELECT SUM(distance) FROM fuelrecords WHERE motorcycleId = " + motor.getId(), true);
            ResultSet otherMotors = database.Query(
                    "SELECT SUM(distance) FROM fuelrecords WHERE NOT motorcycleId = " + motor.getId(), true);
            thisMotor.next();
            otherMotors.next();

            usageDataset.setValue(motor.toString(), thisMotor.getInt("1"));
            usageDataset.setValue("Andere motoren", otherMotors.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("Motorgebruik")));
        usagePiechartPanel.setPreferredSize(new java.awt.Dimension(240, 240));
        usagePiechartPanel.setLayout(new BorderLayout());

        DefaultPieDataset stationDataset = new DefaultPieDataset();
        try {
            for (Station station : database.getStations()) {
                ResultSet numberStations = database.Query(
                        "SELECT DISTINCT stationId FROM fuelrecords WHERE stationId = " + station.getId(),
                        true);
                if (numberStations.next()) {
                    ResultSet otherMotors = database.Query("SELECT COUNT(*) FROM fuelrecords WHERE stationId = "
                            + station.getId() + " AND motorcycleId = " + motor.getId(), true);
                    otherMotors.next();
                    if (otherMotors.getInt("1") > 0) {
                        stationDataset.setValue(station.toString(), otherMotors.getInt("1"));
                    }
                }
            }

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

        JPanel stationPiechartPanel = new ChartPanel(stationPiechart);
        stationPiechartPanel.setBorder(
                BorderFactory.createTitledBorder(BorderFactory.createTitledBorder("Tankstation verhouding")));
        stationPiechartPanel.setPreferredSize(new java.awt.Dimension(240, 240));
        stationPiechartPanel.setLayout(new BorderLayout());

        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") + "'AND motorcycleId = " + motor.getId(),
                        true);
                thisStation.next();
                if (thisStation.getDouble("1") > 0) {
                    fuelDataset.setValue(numberResults.getString("TYPEOFGAS"), thisStation.getDouble("1"));
                }
            }

        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage() + ex.getCause());
        }
        JFreeChart fuelPieChart = ChartFactory.createPieChart3D("", fuelDataset, true, true, false);
        PiePlot3D plot1 = (PiePlot3D) fuelPieChart.getPlot();
        plot1.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(240, 240));

        DefaultCategoryDataset barDataset = new DefaultCategoryDataset();
        try {
            ResultSet motorThing = database
                    .Query("SELECT distance/liter,date FROM fuelrecords WHERE motorcycleId = " + motor.getId()
                            + " ORDER BY date ASC", true);
            while (motorThing.next()) {
                barDataset.addValue(motorThing.getDouble("1"), motorThing.getString("DATE"), "Verbruik");
            }

        } 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("Verbruik"));
        barChartPanel.setPreferredSize(new java.awt.Dimension(320, 240));
        barChartPanel.setLayout(new BorderLayout());

        JPanel piePanel = new JPanel(new GridLayout(0, 3));
        piePanel.add(usagePiechartPanel);
        piePanel.add(stationPiechartPanel);
        piePanel.add(fuelPieChartPanel);

        //uitgaven
        DefaultPieDataset expensesDataset = new DefaultPieDataset();
        try {
            Map<String, ResultSet> allCosts = new HashMap<String, ResultSet>();
            ResultSet fuelCosts = database
                    .Query("SELECT SUM(cost) FROM fuelrecords WHERE motorcycleId = " + motor.getId(), true);
            allCosts.put("Brandstof", fuelCosts);
            ResultSet expenses = database.Query("SELECT DISTINCT categoryid FROM expenses", true);
            while (expenses.next()) {
                ResultSet set = database.Query("SELECT SUM(costs) FROM expenses WHERE categoryid = "
                        + expenses.getInt("categoryid") + " AND motorcycleid = " + motor.getId(), true);
                ResultSet set2 = database
                        .Query("SELECT name FROM categories WHERE id = " + expenses.getInt("categoryid"), true);
                set2.next();
                allCosts.put(set2.getString("name"), set);
            }

            for (Map.Entry<String, ResultSet> element : allCosts.entrySet()) {
                element.getValue().next();
                if (element.getValue().getInt("1") > 0) {
                    expensesDataset.setValue(element.getKey(), element.getValue().getInt("1"));
                }
            }

        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage() + ex.getCause());
        }
        JFreeChart expensesPiechart = ChartFactory.createPieChart3D("", expensesDataset, true, true, false);
        PiePlot3D plot4 = (PiePlot3D) expensesPiechart.getPlot();
        plot4.setForegroundAlpha(0.6f);

        JPanel expensesPiePanel = new ChartPanel(expensesPiechart);
        expensesPiePanel
                .setBorder(BorderFactory.createTitledBorder(BorderFactory.createTitledBorder("Uitgaven")));
        expensesPiePanel.setPreferredSize(new java.awt.Dimension(240, 240));
        expensesPiePanel.setLayout(new BorderLayout());

        graphContainer.add(piePanel);
        graphContainer.add(barChartPanel);
        graphContainer.add(expensesPiePanel);
    }
    revalidate();
    repaint();
}

From source file:userinterface.StateNetworkAdminRole.StateReportsJPanel.java

private JFreeChart createPatientReportsChart(CategoryDataset dataset) {
    JFreeChart barChart = ChartFactory.createBarChart("Average Waiting period of Patients", "Year",
            "Avg Waiting period(months)", dataset, PlotOrientation.VERTICAL, true, true, false);

    barChart.setBackgroundPaint(Color.white);
    // Set the background color of the chart
    barChart.getTitle().setPaint(Color.DARK_GRAY);
    barChart.setBorderVisible(true);// w  ww.  j a v  a 2s.co  m
    // Adjust the color of the title
    CategoryPlot plot = barChart.getCategoryPlot();
    plot.getRangeAxis().setLowerBound(0.0);
    // Get the Plot object for a bar graph
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.blue);
    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.decode("#00008B"));
    //return chart;
    return barChart;
}