Search in sources :

Example 1 with XYBoxAndWhiskerRenderer

use of org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer in project SIMVA-SoS by SESoS.

the class ChartFactory method createBoxAndWhiskerChart.

/**
 * Creates and returns a default instance of a box and whisker chart.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param timeAxisLabel  a label for the time axis (<code>null</code>
 *                       permitted).
 * @param valueAxisLabel  a label for the value axis (<code>null</code>
 *                        permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 *
 * @return A box and whisker chart.
 */
public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel, BoxAndWhiskerXYDataset dataset, boolean legend) {
    ValueAxis timeAxis = new DateAxis(timeAxisLabel);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    valueAxis.setAutoRangeIncludesZero(false);
    XYBoxAndWhiskerRenderer renderer = new XYBoxAndWhiskerRenderer(10.0);
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : DateAxis(org.jfree.chart.axis.DateAxis) XYBoxAndWhiskerRenderer(org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer) NumberAxis(org.jfree.chart.axis.NumberAxis) XYPlot(org.jfree.chart.plot.XYPlot) ValueAxis(org.jfree.chart.axis.ValueAxis)

Aggregations

DateAxis (org.jfree.chart.axis.DateAxis)1 NumberAxis (org.jfree.chart.axis.NumberAxis)1 ValueAxis (org.jfree.chart.axis.ValueAxis)1 XYPlot (org.jfree.chart.plot.XYPlot)1 XYBoxAndWhiskerRenderer (org.jfree.chart.renderer.xy.XYBoxAndWhiskerRenderer)1