Java Code Examples for org.jfree.chart.axis.DateAxis#setTimeline()

The following examples show how to use org.jfree.chart.axis.DateAxis#setTimeline() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartFactory.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart 
 * with a special timeline. This timeline can be a 
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday 
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
                                            Timeline timeline,
                                            boolean legend) {

    DateAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setTimeline(timeline);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    HighLowRenderer renderer = new HighLowRenderer();
    renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    return chart;

}
 
Example 2
Source File: ChartFactory.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart 
 * with a special timeline. This timeline can be a 
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday 
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
                                            Timeline timeline,
                                            boolean legend) {

    DateAxis timeAxis = new DateAxis(timeAxisLabel);
    timeAxis.setTimeline(timeline);
    NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
    HighLowRenderer renderer = new HighLowRenderer();
    renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
            plot, legend);
    return chart;

}
 
Example 3
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {

    DateAxis a1 = new DateAxis("Test");
    DateAxis a2 = new DateAxis("Test");
    assertTrue(a1.equals(a2));
    assertFalse(a1.equals(null));
    assertFalse(a1.equals("Some non-DateAxis object"));

    // tickUnit
    a1.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 7));
    assertFalse(a1.equals(a2));
    a2.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 7));
    assertTrue(a1.equals(a2));

    // dateFormatOverride
    a1.setDateFormatOverride(new SimpleDateFormat("yyyy"));
    assertFalse(a1.equals(a2));
    a2.setDateFormatOverride(new SimpleDateFormat("yyyy"));
    assertTrue(a1.equals(a2));

    // tickMarkPosition
    a1.setTickMarkPosition(DateTickMarkPosition.END);
    assertFalse(a1.equals(a2));
    a2.setTickMarkPosition(DateTickMarkPosition.END);
    assertTrue(a1.equals(a2));

    // timeline
    a1.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    assertFalse(a1.equals(a2));
    a2.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    assertTrue(a1.equals(a2));

}
 
Example 4
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    DateAxis a1 = new DateAxis("Test");
    DateAxis a2 = new DateAxis("Test");
    assertTrue(a1.equals(a2));
    assertFalse(a1.equals(null));
    assertFalse(a1.equals("Some non-DateAxis object"));
    
    // tickUnit 
    a1.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
    assertFalse(a1.equals(a2));
    a2.setTickUnit(new DateTickUnit(DateTickUnit.DAY, 7));
    assertTrue(a1.equals(a2));

    // dateFormatOverride 
    a1.setDateFormatOverride(new SimpleDateFormat("yyyy"));
    assertFalse(a1.equals(a2));
    a2.setDateFormatOverride(new SimpleDateFormat("yyyy"));
    assertTrue(a1.equals(a2));

    // tickMarkPosition
    a1.setTickMarkPosition(DateTickMarkPosition.END);
    assertFalse(a1.equals(a2));
    a2.setTickMarkPosition(DateTickMarkPosition.END);
    assertTrue(a1.equals(a2));
    
    // timeline
    a1.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    assertFalse(a1.equals(a2));
    a2.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    assertTrue(a1.equals(a2));
    
}
 
Example 5
Source File: ChartFactory.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}
 
Example 6
Source File: ChartFactory.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}
 
Example 7
Source File: ChartFactory.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}
 
Example 8
Source File: ChartFactory.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}
 
Example 9
Source File: ChartFactory.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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, Timeline timeline, boolean legend) {

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

}
 
Example 10
Source File: ChartFactory.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}
 
Example 11
Source File: ChartFactory.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates and returns a default instance of a high-low-open-close chart
 * with a special timeline. This timeline can be a
 * {@link org.jfree.chart.axis.SegmentedTimeline} such as the Monday
 * through Friday timeline that will remove Saturdays and Sundays from
 * the axis.
 *
 * @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 timeline  the timeline.
 * @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,
        Timeline timeline, boolean legend) {

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

}