List of usage examples for org.jfree.chart.axis SymbolicAxis SymbolicAxis
public SymbolicAxis(String label, String[] sv)
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; }