Example usage for org.jfree.chart.renderer.xy ScaleType Y_AXIS

List of usage examples for org.jfree.chart.renderer.xy ScaleType Y_AXIS

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.xy ScaleType Y_AXIS.

Prototype

ScaleType Y_AXIS

To view the source code for org.jfree.chart.renderer.xy ScaleType Y_AXIS.

Click Source Link

Document

Scale using the y-axis.

Usage

From source file:org.jfree.chart.ChartFactory.java

/**
 * Creates a bubble chart with default settings.  The chart is composed of
 * an {@link XYPlot}, with a {@link NumberAxis} for the domain axis,
 * a {@link NumberAxis} for the range axis, and an {@link XYBubbleRenderer}
 * to draw the data items./*from   w w  w. j a  v a 2s .c  om*/
 *
 * @param title  the chart title ({@code null} permitted).
 * @param xAxisLabel  a label for the X-axis ({@code null} permitted).
 * @param yAxisLabel  a label for the Y-axis ({@code null} permitted).
 * @param dataset  the dataset for the chart ({@code null} permitted).
 *
 * @return A bubble chart.
 */
public static JFreeChart createBubbleChart(String title, String xAxisLabel, String yAxisLabel,
        XYZDataset dataset) {

    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    xAxis.setAutoRangeIncludesZero(false);
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setAutoRangeIncludesZero(false);

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);

    XYItemRenderer renderer = new XYBubbleRenderer(ScaleType.Y_AXIS);
    renderer.setDefaultToolTipGenerator(new StandardXYZToolTipGenerator());
    plot.setRenderer(renderer);

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

}