Example usage for org.jfree.chart.plot CategoryPlot setColumnRenderingOrder

List of usage examples for org.jfree.chart.plot CategoryPlot setColumnRenderingOrder

Introduction

In this page you can find the example usage for org.jfree.chart.plot CategoryPlot setColumnRenderingOrder.

Prototype

public void setColumnRenderingOrder(SortOrder order) 

Source Link

Document

Sets the column order in which the items in each dataset should be rendered and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:com.pureinfo.srm.reports.impl.MyChartFactory.java

public static JFreeChart createBarChart3D(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.");
    }/*from www.  ja  va 2 s  .  c om*/
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D() {
        /**
         * @see org.jfree.chart.renderer.AbstractRenderer#getItemPaint(int, int)
         */
        public Paint getItemPaint(int _nRow, int _nColumn) {
            return getSeriesPaint(_nColumn);
        }
    };
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the 
        // right way around
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75f);

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:org.jajuk.ui.views.StatView.java

/**
 * Creates the bar chart3 d.//from  ww  w .j  av a2s  .c  o m
 * 
 * 
 * @param title 
 * @param categoryAxisLabel 
 * @param valueAxisLabel 
 * @param dataset 
 * @param orientation 
 * @param legend 
 * @param tooltips 
 * @param urls 
 * @param format 
 * 
 * @return the j free chart
 */
public static JFreeChart createBarChart3D(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls,
        String format) {
    if (orientation == null)
        throw new IllegalArgumentException("Null 'orientation' argument.");
    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);
    BarRenderer3D renderer = new BarRenderer3D();
    if (tooltips)
        renderer.setBaseToolTipGenerator(
                new StandardCategoryToolTipGenerator(format, NumberFormat.getInstance()));
    if (urls)
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75F);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    ChartFactory.getChartTheme().apply(chart);
    return chart;
}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createStackedBarChart3D(CategoryDataset dataset) {

    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    CategoryItemRenderer renderer = new StackedBarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }/*from  w w  w .  ja v a  2  s  .  com*/
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the
        // right way around
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }

    // create the chart...
    JFreeChart chart = new JFreeChart("StackedBar Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot,
            legend);
    chart.setBackgroundPaint(Color.white);

    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    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));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    return chart;

}

From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java

private static JFreeChart createBarChart3D(CategoryDataset dataset) {

    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }/* w  w w.j av a2  s . c  om*/
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the
        // right way around
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75f);

    JFreeChart chart = new JFreeChart("Bar Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    chart.setBackgroundPaint(Color.white);

    plot.setForegroundAlpha(0.5f);

    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    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));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a stacked bar chart with a 3D effect and default settings. The     
* chart object returned by this method uses a {@link CategoryPlot}     
* instance as the plot, with a {@link CategoryAxis3D} for the domain axis,     
* a {@link NumberAxis3D} as the range axis, and a     
* {@link StackedBarRenderer3D} as the renderer.    
*    /*from w w  w .j av a2  s  . c o  m*/
* @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 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 stacked bar chart with a 3D effect.    
*/
public static JFreeChart createStackedBarChart3D(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 CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    // create the renderer...    
    CategoryItemRenderer renderer = new StackedBarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    // create the plot...    
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the     
        // right way around    
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }

    // create the chart...    
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
* Creates a bar chart with a 3D effect. The chart object returned by this     
* method uses a {@link CategoryPlot} instance as the plot, with a     
* {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as     
* the range axis, and a {@link BarRenderer3D} as the renderer.    
*    //w w w. j av a  2  s.c  om
* @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 with a 3D effect.    
*/
public static JFreeChart createBarChart3D(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 CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the     
        // right way around    
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75f);

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:KIDLYFactory.java

/**
 * Creates a stacked bar chart with a 3D effect and default settings. The
 * chart object returned by this method uses a {@link CategoryPlot}
 * instance as the plot, with a {@link CategoryAxis3D} for the domain axis,
 * a {@link NumberAxis3D} as the range axis, and a
 * {@link StackedBarRenderer3D} 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).//from  www.j  a  v  a2 s .  c om
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the 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 stacked bar chart with a 3D effect.
 */
public static JFreeChart createStackedBarChart3D(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 CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    // create the renderer...
    CategoryItemRenderer renderer = new StackedBarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    // create the plot...
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the
        // right way around
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }

    // create the chart...
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;

}

From source file:KIDLYFactory.java

/**
 * Creates a bar chart with a 3D effect. The chart object returned by this
 * method uses a {@link CategoryPlot} instance as the plot, with a
 * {@link CategoryAxis3D} for the domain axis, a {@link NumberAxis3D} as
 * the range axis, and a {@link BarRenderer3D} 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).//from   w ww.j  ava 2s.  co  m
 * @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 with a 3D effect.
 */
public static JFreeChart createBarChart3D(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 CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }

    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    if (orientation == PlotOrientation.HORIZONTAL) {
        // change rendering order to ensure that bar overlapping is the
        // right way around
        plot.setRowRenderingOrder(SortOrder.DESCENDING);
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    plot.setForegroundAlpha(0.75f);

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;

}

From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java

private CategoryPlot getCategoryPlot(List<cfCHARTSERIESData> series, String xAxisTitle, String yAxisTitle,
        String labelFormat, boolean bShowMarkers, int markerSize, boolean bShow3D, String tipStyle,
        String drillDownUrl, int xOffset, int yOffset, int yAxisUnits, String seriesPlacement,
        boolean bSortXAxis, int height, String[] yAxisSymbols, int gridLines) throws cfmRunTimeException {
    // Create a category plot
    CategoryPlot plot = new CategoryPlot();

    // Set the domain axis (the x-axis)
    org.jfree.chart.axis.CategoryAxis categoryAxis;
    if (bShow3D)// w  ww. j a  va  2  s. c  o  m
        categoryAxis = new CategoryAxis3D(xAxisTitle);
    else
        categoryAxis = new CategoryAxis(xAxisTitle);
    plot.setDomainAxis(categoryAxis);

    // Set the range axis (the y-axis)
    ValueAxis valueAxis;
    DateFormat dateFormat = null;
    NumberFormat numberFormat = null;

    // Ignore a label format of date if the y-axis is using symbols
    if (labelFormat.equals("date") && (yAxisSymbols == null)) {
        valueAxis = new DateAxis(yAxisTitle);
        dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
        ((DateAxis) valueAxis).setDateFormatOverride(dateFormat);
    } else {
        if (yAxisSymbols != null) {
            valueAxis = new SymbolAxis(yAxisTitle, yAxisSymbols);
            ((SymbolAxis) valueAxis).setGridBandsVisible(false);
            ((SymbolAxis) valueAxis).setAutoRangeStickyZero(true);
        } else if (bShow3D) {
            valueAxis = new NumberAxis3D(yAxisTitle);
        } else {
            valueAxis = new NumberAxis(yAxisTitle);
        }

        if (labelFormat.equals("currency")) {
            ((NumberAxis) valueAxis).setNumberFormatOverride(NumberFormat.getCurrencyInstance());
            numberFormat = NumberFormat.getCurrencyInstance();
        } else if (labelFormat.equals("percent")) {
            numberFormat = NumberFormat.getPercentInstance();
            numberFormat.setMaximumFractionDigits(3); // without this change .11443
                                                      // would be displayed as 11%
                                                      // instead of 11.443%
            ((NumberAxis) valueAxis).setNumberFormatOverride(numberFormat);
        } else {
            numberFormat = NumberFormat.getInstance();
        }

        if (yAxisUnits != 0)
            ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits));
    }
    plot.setRangeAxis(valueAxis);

    // Add a dataset and renderer for each series
    int barChartDatasetIndex = -1;
    int hBarChartDatasetIndex = -1;
    int num = 0;
    MinMaxData minMax = new MinMaxData();
    for (int i = 0; i < series.size(); i++) {
        cfCHARTSERIESData seriesData = series.get(i);

        // If the sortXAxis attribute was set to "yes" then sort the data.
        // NOTE: this attribute is only used with category charts.
        if (bSortXAxis)
            seriesData.sort();

        DefaultCategoryDataset dataset;
        if ((barChartDatasetIndex != -1) && (seriesData.getType().equals("bar"))) {
            dataset = (DefaultCategoryDataset) plot.getDataset(barChartDatasetIndex);

            addSeriesDataToDataset(seriesData, dataset, minMax);

            // Set the paint style for this series
            setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(barChartDatasetIndex),
                    dataset.getRowCount() - 1, height);

            // Add the color list for this series to the custom color renderer
            CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(barChartDatasetIndex);
            cr.addColors(getColorList(seriesData));

            continue;
        } else if ((hBarChartDatasetIndex != -1) && (seriesData.getType().equals("horizontalbar"))) {
            dataset = (DefaultCategoryDataset) plot.getDataset(hBarChartDatasetIndex);

            addSeriesDataToDataset(seriesData, dataset, minMax);

            // Set the paint style for this series
            setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(hBarChartDatasetIndex),
                    dataset.getRowCount() - 1, height);

            // Add the color list for this series to the custom color renderer
            CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(hBarChartDatasetIndex);
            cr.addColors(getColorList(seriesData));

            continue;
        } else {
            dataset = new DefaultCategoryDataset();

            addSeriesDataToDataset(seriesData, dataset, minMax);
        }

        plot.setDataset(num, dataset);

        AbstractCategoryItemRenderer renderer = null;
        if (seriesData.getType().equals("bar")) {
            plot.setOrientation(PlotOrientation.VERTICAL);
            renderer = getBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData));
            ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,
                    TextAnchor.BOTTOM_CENTER);
            renderer.setPositiveItemLabelPosition(position1);
            ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6,
                    TextAnchor.TOP_CENTER);
            renderer.setNegativeItemLabelPosition(position2);
            ((BarRenderer) renderer).setItemMargin(0.0); // The margin between items
                                                         // in the same category
            categoryAxis.setCategoryMargin(0.2); // The margin between each category

            barChartDatasetIndex = num;
        } else if (seriesData.getType().equals("horizontalbar")) {
            plot.setOrientation(PlotOrientation.HORIZONTAL);
            plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
            renderer = getBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData));
            if (bShow3D) {
                // change rendering order to ensure that bar overlapping is the
                // right way around
                plot.setRowRenderingOrder(org.jfree.util.SortOrder.DESCENDING);
                plot.setColumnRenderingOrder(org.jfree.util.SortOrder.DESCENDING);
            }
            ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3,
                    TextAnchor.CENTER_LEFT);
            renderer.setPositiveItemLabelPosition(position1);
            ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9,
                    TextAnchor.CENTER_RIGHT);
            renderer.setNegativeItemLabelPosition(position2);
            ((BarRenderer) renderer).setItemMargin(0.0); // The margin between items
                                                         // in the same category
            categoryAxis.setCategoryMargin(0.2); // The margin between each category

            hBarChartDatasetIndex = num;
        } else if (seriesData.getType().equals("line")) {
            if (bShow3D) {
                renderer = new LineRenderer3D();
                ((LineRenderer3D) renderer).setXOffset(xOffset);
                ((LineRenderer3D) renderer).setYOffset(yOffset);
            } else {
                renderer = new LineAndShapeRenderer(true, false);
            }

            // Enable/Disable displaying of markers
            ((LineAndShapeRenderer) renderer).setShapesVisible(bShowMarkers);

            // Set the shape of the markers based on the markerSize value
            ((LineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize));
        } else if (seriesData.getType().equals("area")) {
            if (seriesPlacement.equals("stacked"))
                renderer = new StackedAreaRenderer(); // this doesn't work for some
                                                      // reason
            else
                renderer = new AreaRenderer();

            // Truncate the first and last values to match CFMX 7
            ((AreaRenderer) renderer).setEndType(AreaRendererEndType.TRUNCATE);

            categoryAxis.setCategoryMargin(0.0);
        } else if (seriesData.getType().equals("step")) {
            renderer = new CategoryStepRenderer(true);
        } else if (seriesData.getType().equals("scatter")) {
            renderer = new LineAndShapeRenderer(false, true);

            // Set the shape of the markers based on the markerSize value
            ((LineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize));
        }

        if (!tipStyle.equals("none")) {
            if (dateFormat != null)
                renderer.setBaseToolTipGenerator(
                        new StandardCategoryToolTipGenerator("({0}, {1}) = {2}", dateFormat));
            else
                renderer.setBaseToolTipGenerator(
                        new StandardCategoryToolTipGenerator("({0}, {1}) = {2}", numberFormat));
        }

        if (drillDownUrl != null) {
            if (dateFormat != null)
                renderer.setBaseItemURLGenerator(
                        new com.newatlanta.bluedragon.CategoryURLGenerator(drillDownUrl, dateFormat));
            else
                renderer.setBaseItemURLGenerator(
                        new com.newatlanta.bluedragon.CategoryURLGenerator(drillDownUrl, numberFormat));
        }

        if (seriesData.getSeriesColor() != null)
            renderer.setSeriesPaint(0, convertStringToColor(seriesData.getSeriesColor()));

        String dataLabelStyle = seriesData.getDataLabelStyle();
        if (labelFormat.equals("date")) {
            if (dataLabelStyle.equals("none")) {
                renderer.setItemLabelsVisible(false);
            } else {
                setCategoryItemLabelsData(renderer, seriesData);
                if (dataLabelStyle.equals("value"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{2}", dateFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("rowlabel"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{0}", dateFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("columnlabel"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{1}", dateFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("pattern"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{1} {2}", dateFormat, yAxisSymbols));
                else
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator(dataLabelStyle, dateFormat, yAxisSymbols));
            }
        } else {
            if (dataLabelStyle.equals("none")) {
                renderer.setItemLabelsVisible(false);
            } else {
                setCategoryItemLabelsData(renderer, seriesData);
                if (dataLabelStyle.equals("value"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{2}", numberFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("rowlabel"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{0}", numberFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("columnlabel"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{1}", numberFormat, yAxisSymbols));
                else if (dataLabelStyle.equals("pattern"))
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator("{1} {2} ({3} of {4})", numberFormat, yAxisSymbols));
                else
                    renderer.setItemLabelGenerator(
                            new CategoryItemLabelGenerator(dataLabelStyle, numberFormat, yAxisSymbols));
            }
        }

        // Add the renderer to the plot.
        // NOTE: this must be done before the setPaintStyle() call so the
        // DrawingSupplier object
        // will be set up properly for the generation of default colors.
        plot.setRenderer(num, renderer);

        // Set the paint style for this series (series 0)
        if (seriesData.getType().equals("bar") || seriesData.getType().equals("horizontalbar")
                || seriesData.getType().equals("area"))
            setPaintStyle(seriesData.getPaintStyle(), renderer, 0, height);

        num++;
    }

    // If gridLines was specified then we need to calculate the yAxisUnits
    if ((gridLines != -1) && (valueAxis instanceof NumberAxis)) {
        // Calculate the yAxisUnits we need to use to create the number of
        // gridLines
        yAxisUnits = calculateYAxisUnits(gridLines, minMax);

        // Set the yAxisUnits
        ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits));
    }

    return plot;
}