Example usage for org.jfree.chart.axis CategoryAxis3D CategoryAxis3D

List of usage examples for org.jfree.chart.axis CategoryAxis3D CategoryAxis3D

Introduction

In this page you can find the example usage for org.jfree.chart.axis CategoryAxis3D CategoryAxis3D.

Prototype

public CategoryAxis3D(String label) 

Source Link

Document

Creates a new axis using default attribute values.

Usage

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

/**
 * Creates the bar chart3 d./* w  w w  .j  a  v  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());
    }//www.j  a v  a2s.  co  m
    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 createLineChart3D(CategoryDataset dataset) {

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

    LineRenderer3D renderer = new LineRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }//from   w w w .  j ava 2s. c  o m
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart("Line Chart 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);

    GradientPaint gp = new GradientPaint(0.0f, 0.0f, Color.orange, 0.0f, 0.0f, new Color(0, 64, 64));
    renderer.setWallPaint(gp);

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

    return chart;

}

From source file:org.orbeon.oxf.processor.serializer.legacy.JFreeChartSerializer.java

protected JFreeChart drawChart(ChartConfig chartConfig, final Dataset ds) {
    JFreeChart chart = null;/*w  ww.j  av  a  2s.  co m*/
    Axis categoryAxis = null;
    if (ds instanceof XYSeriesCollection) {
        categoryAxis = new RestrictedNumberAxis(chartConfig.getCategoryTitle());
    } else if (ds instanceof TimeSeriesCollection) {
        categoryAxis = new DateAxis(chartConfig.getCategoryTitle());
        ((DateAxis) categoryAxis).setDateFormatOverride(new SimpleDateFormat(chartConfig.getDateFormat()));
        if (chartConfig.getCategoryLabelAngle() == 90) {
            ((DateAxis) categoryAxis).setVerticalTickLabels(true);
        } else {
            if (chartConfig.getCategoryLabelAngle() != 0)
                throw new OXFException(
                        "The only supported values of category-label-angle for time-series charts are 0 or 90");
        }
    } else {
        categoryAxis = new CategoryAxis(chartConfig.getCategoryTitle());
        ((CategoryAxis) categoryAxis).setCategoryLabelPositions(chartConfig.getCategoryLabelPosition());
    }
    NumberAxis valueAxis = new RestrictedNumberAxis(chartConfig.getSerieTitle());
    valueAxis.setAutoRangeIncludesZero(chartConfig.getSerieAutoRangeIncludeZero());
    AbstractRenderer renderer = null;
    Plot plot = null;

    switch (chartConfig.getType()) {
    case ChartConfig.VERTICAL_BAR_TYPE:
    case ChartConfig.HORIZONTAL_BAR_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new BarRenderer();

        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.VERTICAL_BAR_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.STACKED_VERTICAL_BAR_TYPE:
    case ChartConfig.STACKED_HORIZONTAL_BAR_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new StackedBarRenderer();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);
        break;
    case ChartConfig.LINE_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new LineAndShapeRenderer(true, false) {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : (new LineAndShapeRenderer(true, false));
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);
        ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        break;
    case ChartConfig.AREA_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new AreaRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new AreaRenderer();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);
        ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        break;
    case ChartConfig.VERTICAL_BAR3D_TYPE:
    case ChartConfig.HORIZONTAL_BAR3D_TYPE:
        categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle());
        valueAxis = new NumberAxis3D(chartConfig.getSerieTitle());
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer3D() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new BarRenderer3D();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.VERTICAL_BAR3D_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.STACKED_VERTICAL_BAR3D_TYPE:
    case ChartConfig.STACKED_HORIZONTAL_BAR3D_TYPE:
        categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle());
        valueAxis = new NumberAxis3D(chartConfig.getSerieTitle());
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer3D() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new StackedBarRenderer3D();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR3D_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.PIE_TYPE:
    case ChartConfig.PIE3D_TYPE:
        categoryAxis = null;
        valueAxis = null;
        renderer = null;
        ExtendedPieDataset pds = (ExtendedPieDataset) ds;

        plot = chartConfig.getType() == ChartConfig.PIE_TYPE ? new PiePlot(pds) : new PiePlot3D(pds);

        PiePlot pp = (PiePlot) plot;
        pp.setLabelGenerator(new StandardPieSectionLabelGenerator());

        for (int i = 0; i < pds.getItemCount(); i++) {
            Paint p = pds.getPaint(i);
            if (p != null)
                pp.setSectionPaint(i, p);

            pp.setExplodePercent(i, pds.getExplodePercent(i));

            Paint paint = pds.getPaint(i);
            if (paint != null)
                pp.setSectionPaint(i, paint);
        }
        break;
    case ChartConfig.XY_LINE_TYPE:
        renderer = new XYLineAndShapeRenderer(true, false);
        plot = new XYPlot((XYDataset) ds, (ValueAxis) categoryAxis, (ValueAxis) valueAxis,
                (XYLineAndShapeRenderer) renderer);
        break;
    case ChartConfig.TIME_SERIES_TYPE:
        renderer = new XYLineAndShapeRenderer(true, false);
        plot = new XYPlot((XYDataset) ds, (DateAxis) categoryAxis, (ValueAxis) valueAxis,
                (XYLineAndShapeRenderer) renderer);
        break;
    default:
        throw new OXFException("Chart Type not supported");
    }

    if (categoryAxis != null) {
        categoryAxis.setLabelPaint(chartConfig.getTitleColor());
        categoryAxis.setTickLabelPaint(chartConfig.getTitleColor());
        categoryAxis.setTickMarkPaint(chartConfig.getTitleColor());
        if (categoryAxis instanceof RestrictedNumberAxis) {
            ((RestrictedNumberAxis) categoryAxis).setMaxTicks(chartConfig.getMaxNumOfLabels());
        }
        if (categoryAxis instanceof CategoryAxis && chartConfig.getCategoryMargin() != 0)
            ((CategoryAxis) categoryAxis).setCategoryMargin(chartConfig.getCategoryMargin());
    }

    if (valueAxis != null) {
        valueAxis.setLabelPaint(chartConfig.getTitleColor());
        valueAxis.setTickLabelPaint(chartConfig.getTitleColor());
        valueAxis.setTickMarkPaint(chartConfig.getTitleColor());
        ((RestrictedNumberAxis) valueAxis).setMaxTicks(chartConfig.getMaxNumOfLabels());
    }

    if (renderer != null) {
        if (renderer instanceof XYLineAndShapeRenderer) {
            ((XYLineAndShapeRenderer) renderer).setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        } else {
            ((CategoryItemRenderer) renderer)
                    .setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        }
        if (renderer instanceof BarRenderer)
            ((BarRenderer) renderer).setItemMargin(chartConfig.getBarMargin());

        int j = 0;
        for (Iterator i = chartConfig.getValueIterator(); i.hasNext();) {
            Value v = (Value) i.next();
            renderer.setSeriesPaint(j, v.getColor());
            j++;
        }
    }

    plot.setOutlinePaint(chartConfig.getTitleColor());
    CustomLegend legend = chartConfig.getLegendConfig();
    chart = new JFreeChart(chartConfig.getTitle(), TextTitle.DEFAULT_FONT, plot, false);
    if (legend.isVisible()) {
        legend.setSources(new LegendItemSource[] { plot });
        chart.addLegend(legend);
    }
    chart.setBackgroundPaint(chartConfig.getBackgroundColor());
    TextTitle textTitle = new TextTitle(chartConfig.getTitle(), TextTitle.DEFAULT_FONT,
            chartConfig.getTitleColor(), TextTitle.DEFAULT_POSITION, TextTitle.DEFAULT_HORIZONTAL_ALIGNMENT,
            TextTitle.DEFAULT_VERTICAL_ALIGNMENT, TextTitle.DEFAULT_PADDING);
    chart.setTitle(textTitle);
    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  .  ja va2  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 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 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)./*  www . j a  v a 2 s  . c om*/
 * @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: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  ww w . ja  v 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 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: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).//  w ww  .  j  a  v a2  s  .  c o m
 * @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:edu.dlnu.liuwenpeng.ChartFactory.ChartFactory.java

/**    
 * Creates a line chart with 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 LineRenderer3D} 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 chart 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 line chart.    
 */
public static JFreeChart createLineChart3D(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);

    LineRenderer3D renderer = new LineRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);

    return chart;

}

From source file:KIDLYFactory.java

/**
 * Creates a line chart with 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 LineRenderer3D} 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 w  w .  ja va  2s .c o m
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the chart 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 line chart.
 */
public static JFreeChart createLineChart3D(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);

    LineRenderer3D renderer = new LineRenderer3D();
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;

}