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

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

Introduction

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

Prototype

public SymbolicAxis(String label, String[] sv) 

Source Link

Document

Constructs a symbolic axis, using default attribute values where necessary.

Usage

From source file:org.jfree.chart.demo.SymbolicYPlotDemo.java

/**
 * Creates a XY graph with symbolic value on Y axis.
 * //from ww w  . j  av a2 s  . c om
 * @param title
 *           the chart title.
 * @param xAxisLabel
 *           the x-axis label.
 * @param yAxisLabel
 *           the y-axis label.
 * @param data
 *           the data.
 * @param legend
 *           a flag controlling whether or not the legend is created for the chart.
 * @return the chart.
 */
public static JFreeChart createYSymbolicPlot(final String title, final String xAxisLabel,
        final String yAxisLabel, final XYDataset data, final boolean legend) {

    final ValueAxis valueAxis = new NumberAxis(xAxisLabel);
    final SymbolicAxis symbolicAxis = new SymbolicAxis(yAxisLabel, ((YisSymbolic) data).getYSymbolicValues());

    final XYPlot plot = new XYPlot(data, valueAxis, symbolicAxis, null);
    final XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES,
            new SymbolicXYItemLabelGenerator());
    plot.setRenderer(renderer);
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    return chart;

}