本文整理汇总了Java中org.jfree.chart.axis.DateAxis.setTimeline方法的典型用法代码示例。如果您正苦于以下问题:Java DateAxis.setTimeline方法的具体用法?Java DateAxis.setTimeline怎么用?Java DateAxis.setTimeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.axis.DateAxis
的用法示例。
在下文中一共展示了DateAxis.setTimeline方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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;
}
示例2: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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;
}
示例3: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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;
}
示例4: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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));
// 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));
}
示例5: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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));
}
示例6: testEquals
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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));
}
示例7: configureDomainAxis
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/** Configures the domain axis. */
private void configureDomainAxis(DateAxis domainAxis) {
domainAxis.setDateFormatOverride(new SimpleDateFormat(resolution
.getDomainFormat()));
if (useLogDateAxis) {
domainAxis.setTimeline(new LogTimeLine());
domainAxis.setTickUnit(new FixedDateTickUnit());
domainAxis.setLowerMargin(0.0);
domainAxis.setUpperMargin(0.0);
}
}
示例8: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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;
}
示例9: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
/**
* 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;
}
示例10: initChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
public JFreeChart initChart(final StripedCloseFunction stripedCloseFunction) {
Runnable runnable = new Runnable() {
@Override
public void run() {
Date arbitraryStartDate = stripedCloseFunction.getArbitraryStartDateForChart();
Date arbitraryEndDate = stripedCloseFunction.getArbitraryEndDate();
xAxis = new DateAxis();
xAxis.setAutoRange(true);
xAxis.setTimeline(tradingTimeLine());
xAxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, domainTicksMultiple(arbitraryStartDate, arbitraryEndDate)));
xAxis.setMinorTickMarksVisible(true);
if (jFreeTimePeriod.equals(JFreeChartTimePeriod.DAY)) xAxis.setDateFormatOverride(new SimpleDateFormat("dd MMM yy"));
/// Y axis
//Line Y axis
mainYAxis = new NumberAxis();
mainYAxis.setAutoRange(true);
mainYAxis.setAutoRangeIncludesZero(false);
mainYAxis.setTickLabelFont(mainYAxis.getTickLabelFont().deriveFont(7f));
mainYAxis.setLabelFont(mainYAxis.getLabelFont().deriveFont(10f));
//Indicator Y axis (indicator is not showing at init)
//indicYAxis = initYAxis();
/// Plots
//Lines
XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
lineRenderer.setBaseItemLabelsVisible(true);
TimeSeriesCollection lineDataset = new TimeSeriesCollection();
mainPlot = new XYPlot(lineDataset, null, null, lineRenderer);
mainPlot.addRangeMarker(new ValueMarker(0));
mainPlot.setRangeAxis(0, mainYAxis);
mainPlot.setDomainMinorGridlinesVisible(true);
//Bars
TimeSeriesCollection barDataset = new TimeSeriesCollection();
XYBarRenderer barRenderer = new XYBarRenderer();
mainPlot.setRenderer(1, barRenderer);
barChartDisplayStrategy.setBarYAxis();
mainPlot.setDataset(1, barDataset);
//Indicator plot
//This is not created from start
//Combine
CombinedDomainXYPlot combinedDomainXYPlot = new CombinedDomainXYPlot(xAxis);
combinedDomainXYPlot.add(mainPlot, CHARTS_TOTAL_WEIGHT);
//Create
ChartMain.this.jFreeChart = new JFreeChart(combinedDomainXYPlot);
ChartMain.this.jFreeChart.removeLegend();
}
};
try {
EventQueue.invokeAndWait(runnable);
} catch (Exception e) {
LOGGER.error(e,e);
}
return this.jFreeChart;
}