afreechart/src/main/java/org/afree/chart/ChartFactory.java
/**
     * Creates a bar chart. The chart object returned by this method uses a
     * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
     * for the domain axis, a {@link NumberAxis} as the range axis, and a
     * {@link BarRenderer} as the renderer.
     * 
     * @param title
     *            the chart title (<code>null</code> permitted).
     * @param categoryAxisLabel
     *            the label for the category axis (<code>null</code> permitted).
     * @param valueAxisLabel
     *            the label for the value axis (<code>null</code> permitted).
     * @param dataset
     *            the dataset for the chart (<code>null</code> permitted).
     * @param orientation
     *            the plot orientation (horizontal or vertical) (
     *            <code>null</code> not permitted).
     * @param legend
     *            a flag specifying whether or not a legend is required.
     * @param tooltips
     *            configure chart to generate tool tips?
     * @param urls
     *            configure chart to generate URLs?
     * 
     * @return A bar chart.
     */
Creates a bar chart. The chart object returned by this method uses a
CategoryPlot instance as the plot, with a  CategoryAxis
for the domain axis, a  NumberAxis as the range axis, and a
BarRenderer as the renderer.

@param title
the chart title (null permitted).
@param categoryAxisLabel
the label for the category axis (null permitted).
@param valueAxisLabel
the label for the value axis (null permitted).
@param dataset
the dataset for the chart (null permitted).
@param orientation
the plot orientation (horizontal or vertical) (
null not permitted).
@param legend
a flag specifying whether or not a legend is required.
@param tooltips
configure chart to generate tool tips.

@return A bar chart.
Creates a bar chart . The chart object returned by this method uses a CategoryPlot instance as the plot with a CategoryAxis for the domain axis a NumberAxis as the range axis and a BarRenderer as the renderer . @param title the chart title ( null permitted ) . @param categoryAxisLabel the label for the category axis ( null permitted ) . @param valueAxisLabel the label for the value axis ( null permitted ) . @param dataset the dataset for the chart ( null permitted ) . @param orientation the plot orientation ( horizontal or vertical ) ( null not permitted ) . @param legend a flag specifying whether or not a legend is required . @param tooltips configure chart to generate tool tips . @return A bar chart .
public static AFreeChart createBarChart(String title,
            String categoryAxisLabel, String valueAxisLabel,
            CategoryDataset dataset, PlotOrientation orientation,
            boolean legend, boolean tooltips, boolean urls) {
        if (orientation == null) {
            throw new IllegalArgumentException("Null 'orientation' argument.");
        }
        CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
        ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
        BarRenderer renderer = new BarRenderer();
        if (orientation == PlotOrientation.HORIZONTAL) {
            ItemLabelPosition position1 = new ItemLabelPosition(
                    ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
            renderer.setBasePositiveItemLabelPosition(position1);
            ItemLabelPosition position2 = new ItemLabelPosition(
                    ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
            renderer.setBaseNegativeItemLabelPosition(position2);
        } else if (orientation == PlotOrientation.VERTICAL) {
            ItemLabelPosition position1 = new ItemLabelPosition(
                    ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
            renderer.setBasePositiveItemLabelPosition(position1);
            ItemLabelPosition position2 = new ItemLabelPosition(
                    ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
            renderer.setBaseNegativeItemLabelPosition(position2);
        }
        CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis,
                renderer);
        plot.setOrientation(orientation);
        AFreeChart chart = new AFreeChart(title, AFreeChart.DEFAULT_TITLE_FONT,
                plot, legend);
        return chart;
    }
public static AFreeChart createBarChart ( String title , String categoryAxisLabel , String valueAxisLabel , CategoryDataset dataset , PlotOrientation orientation , boolean legend , boolean tooltips , boolean urls ) { if ( orientation == null ) { throw new IllegalArgumentException ( "Null 'orientation' argument." ) ; } CategoryAxis categoryAxis = new CategoryAxis ( categoryAxisLabel ) ; ValueAxis valueAxis = new NumberAxis ( valueAxisLabel ) ; BarRenderer renderer = new BarRenderer ( ) ; if ( orientation == PlotOrientation . HORIZONTAL ) { ItemLabelPosition position1 = new ItemLabelPosition ( ItemLabelAnchor . OUTSIDE3 , TextAnchor . CENTER_LEFT ) ; renderer . setBasePositiveItemLabelPosition ( position1 ) ; ItemLabelPosition position2 = new ItemLabelPosition ( ItemLabelAnchor . OUTSIDE9 , TextAnchor . CENTER_RIGHT ) ; renderer . setBaseNegativeItemLabelPosition ( position2 ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { ItemLabelPosition position1 = new ItemLabelPosition ( ItemLabelAnchor . OUTSIDE12 , TextAnchor . BOTTOM_CENTER ) ; renderer . setBasePositiveItemLabelPosition ( position1 ) ; ItemLabelPosition position2 = new ItemLabelPosition ( ItemLabelAnchor . OUTSIDE6 , TextAnchor . TOP_CENTER ) ; renderer . setBaseNegativeItemLabelPosition ( position2 ) ; } CategoryPlot plot = new CategoryPlot ( dataset , categoryAxis , valueAxis , renderer ) ; plot . setOrientation ( orientation ) ; AFreeChart chart = new AFreeChart ( title , AFreeChart . DEFAULT_TITLE_FONT , plot , legend ) ; return chart ; }
Creates a bar chart.
Creates a bar chart .