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

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

Introduction

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

Prototype

public DateAxis(String label) 

Source Link

Document

Creates a date axis with the specified label.

Usage

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

/**
 * Creates and returns a default instance of a high-low-open-close chart.
 *
 * @param title  the chart title ({@code null} permitted).
 * @param timeAxisLabel  a label for the time axis ({@code null} permitted).
 * @param valueAxisLabel  a label for the value axis ({@code null} 
 *     permitted).//from w  w  w. ja va  2  s  .  c o  m
 * @param dataset  the dataset for the chart ({@code null} permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 *
 * @return A high-low-open-close chart.
 */
public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel,
        OHLCDataset dataset, boolean legend) {

    DateAxis timeAxis = new DateAxis(timeAxisLabel);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    HighLowRenderer renderer = new HighLowRenderer();
    renderer.setDefaultToolTipGenerator(new HighLowItemLabelGenerator());
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;

}

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

/**
 * 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).//from   ww w  . j a va  2 s .  c  om
 * @param valueAxisLabel  a label for the value axis (<code>null</code>
 *                        permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 *
 * @return A box and whisker chart.
 */
public static JFreeChart createBoxAndWhiskerChart(String title, String timeAxisLabel, String valueAxisLabel,
        BoxAndWhiskerXYDataset dataset) {

    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, plot);
    currentTheme.apply(chart);
    return chart;

}

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

/**
 * Creates a wind plot with default settings.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param xAxisLabel  a label for the x-axis (<code>null</code> permitted).
 * @param yAxisLabel  a label for the y-axis (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 *
 * @return A wind plot.// www  .ja v a2  s  .  c  om
 */
public static JFreeChart createWindPlot(String title, String xAxisLabel, String yAxisLabel,
        WindDataset dataset) {

    ValueAxis xAxis = new DateAxis(xAxisLabel);
    ValueAxis yAxis = new NumberAxis(yAxisLabel);
    yAxis.setRange(-12.0, 12.0);

    WindItemRenderer renderer = new WindItemRenderer();
    renderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator());
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
    JFreeChart chart = new JFreeChart(title, plot);
    currentTheme.apply(chart);
    return chart;

}