/** * Creates and returns a default instance of a high-low-open-close 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 high-low-open-close chart. */ public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); HighLowRenderer renderer = new HighLowRenderer(); renderer.setToolTipGenerator(new HighLowItemLabelGenerator()); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
/** * 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 trough 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.setToolTipGenerator(new HighLowItemLabelGenerator()); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart; }
/** * Creates and returns a default instance of a high-low-open-close 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 high-low-open-close chart. */ public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); 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; }
/** * 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; }
/** * Creates and returns a default instance of a high-low-open-close 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 high-low-open-close chart. */ public static JFreeChart createHighLowChart(String title, String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset, boolean legend) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); 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; }
/** * 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). * @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) { ValueAxis 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, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); currentTheme.apply(chart); return chart; }
/** * 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; }
/** * Simple check that hashCode is implemented. */ public void testHashCode() { HighLowItemLabelGenerator g1 = new HighLowItemLabelGenerator(); HighLowItemLabelGenerator g2 = new HighLowItemLabelGenerator(); assertTrue(g1.equals(g2)); assertTrue(g1.hashCode() == g2.hashCode()); }
/** * Returns a chart object. * * @param title * @param timeAxisLabel * @param valueAxisLabel * @param dataSet * @param timeline * @param theme * @param legend * @return */ public static Chart createTimeBasedChart(String title, String timeAxisLabel, String valueAxisLabel, ChartDataset dataSet, Timeline timeline, DefaultTheme theme, boolean legend) { //x-axis DateAxis timeAxis = new DateAxis(timeAxisLabel); timeAxis.setTimeline(timeline); //timeAxis.setTimeZone(dataSet.getTimeline().timeZone); if (dataSet instanceof TickChart || dataSet instanceof ContractChart) { timeAxis.setStandardTickUnits(createSimpleTimeTickUnits()); //timeAxis.setTickUnit(new DateTickUnit(DateTickUnitType.MINUTE, 30, // new SimpleDateFormat("HH:mm")), // false, true); } //y-axis NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeStickyZero(false); valueAxis.setAutoRangeIncludesZero(false); //renderer OHLCRenderer renderer = new OHLCRenderer(); renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator()); //Primary plot XYPlot plot = new XYPlot(dataSet, timeAxis, valueAxis, renderer); plot.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT, false); Chart chart = new Chart( title, Chart.DEFAULT_TITLE_FONT, plot, legend); theme.apply(chart); return chart; }
/** * Check to ensure that this class implements PublicCloneable. */ public void testPublicCloneable() { HighLowItemLabelGenerator g1 = new HighLowItemLabelGenerator(); assertTrue(g1 instanceof PublicCloneable); }
/** * Creates a new renderer for candlestick charts. * <P> * Use -1 for the candle width if you prefer the width to be calculated automatically. * * @param candleWidth The candle width. */ public CandlestickRenderer(double candleWidth) { this(candleWidth, true, new HighLowItemLabelGenerator()); }
/** * Creates a new renderer for candlestick charts. * <P> * Use -1 for the candle width if you prefer the width to be calculated * automatically. * * @param candleWidth The candle width. */ public CandlestickRenderer(double candleWidth) { this(candleWidth, true, new HighLowItemLabelGenerator()); }