本文整理汇总了Java中org.jfree.chart.axis.DateAxis类的典型用法代码示例。如果您正苦于以下问题:Java DateAxis类的具体用法?Java DateAxis怎么用?Java DateAxis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DateAxis类属于org.jfree.chart.axis包,在下文中一共展示了DateAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWindPlot
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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).
* @param legend a flag that controls whether or not a legend is created.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A wind plot.
*
*/
public static JFreeChart createWindPlot(String title,
String xAxisLabel,
String yAxisLabel,
WindDataset dataset,
boolean legend,
boolean tooltips,
boolean urls) {
ValueAxis xAxis = new DateAxis(xAxisLabel);
ValueAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setRange(-12.0, 12.0);
WindItemRenderer renderer = new WindItemRenderer();
if (tooltips) {
renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYURLGenerator());
}
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例2: plotSeperate
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
private void plotSeperate(XYDataset dataset, String p)
{
NumberAxis rangeAxis1 = new NumberAxis(p);
rangeAxis1.setAutoRangeIncludesZero(false); // override default
rangeAxis1.setLowerMargin(0.40); // to leave room for volume bars
DecimalFormat format = new DecimalFormat("0");
rangeAxis1.setNumberFormatOverride(format);
final ValueAxis timeAxis = new DateAxis("Date");
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis1, null);
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00#")
)
);
plot.setRenderer(0, renderer1);
final CombinedDomainXYPlot cplot1 = (CombinedDomainXYPlot)this.candlestickChart.getPlot();
if (plot != null) cplot1.add(plot, 1); // weight is 1.
}
示例3: createCandlestickChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a candlesticks 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 candlestick chart.
*/
public static JFreeChart createCandlestickChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
plot.setRenderer(new CandlestickRenderer());
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例4: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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;
}
示例5: createSignalChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a signal 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 signal chart.
*/
public static JFreeChart createSignalChart(String title,
String timeAxisLabel,
String valueAxisLabel,
SignalsDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
plot.setRenderer(new SignalRenderer());
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例6: createBoxAndWhiskerChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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);
return chart;
}
示例7: testSetRange
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* Test that the setRange() method works.
*/
public void testSetRange() {
DateAxis axis = new DateAxis("Test Axis");
Calendar calendar = Calendar.getInstance();
calendar.set(1999, Calendar.JANUARY, 3);
Date d1 = calendar.getTime();
calendar.set(1999, Calendar.JANUARY, 31);
Date d2 = calendar.getTime();
axis.setRange(d1, d2);
DateRange range = (DateRange) axis.getRange();
assertEquals(d1, range.getLowerDate());
assertEquals(d2, range.getUpperDate());
}
示例8: testJava2DToValue
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* Test the translation of Java2D values to data values.
*/
public void testJava2DToValue() {
DateAxis axis = new DateAxis();
axis.setRange(50.0, 100.0);
Rectangle2D dataArea = new Rectangle2D.Double(10.0, 50.0, 400.0, 300.0);
double y1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
assertTrue(same(y1, 95.8333333, 1.0));
double y2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
assertTrue(same(y2, 95.8333333, 1.0));
double x1 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
assertTrue(same(x1, 58.125, 1.0));
double x2 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
assertTrue(same(x2, 58.125, 1.0));
axis.setInverted(true);
double y3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.LEFT);
assertTrue(same(y3, 54.1666667, 1.0));
double y4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.RIGHT);
assertTrue(same(y4, 54.1666667, 1.0));
double x3 = axis.java2DToValue(75.0, dataArea, RectangleEdge.TOP);
assertTrue(same(x3, 91.875, 1.0));
double x4 = axis.java2DToValue(75.0, dataArea, RectangleEdge.BOTTOM);
assertTrue(same(x4, 91.875, 1.0));
}
示例9: createCandlestickChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* Creates and returns a default instance of a candlesticks 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 candlestick chart.
*/
public static JFreeChart createCandlestickChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
plot.setRenderer(new CandlestickRenderer());
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
示例10: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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;
}
示例11: createBoxAndWhiskerChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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);
return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot,
legend);
}
示例12: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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;
}
示例13: createBoxAndWhiskerChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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;
}
示例14: createWindPlot
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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).
* @param legend a flag that controls whether or not a legend is created.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A wind plot.
*
*/
public static JFreeChart createWindPlot(String title, String xAxisLabel,
String yAxisLabel, WindDataset dataset, boolean legend,
boolean tooltips, boolean urls) {
ValueAxis xAxis = new DateAxis(xAxisLabel);
ValueAxis yAxis = new NumberAxis(yAxisLabel);
yAxis.setRange(-12.0, 12.0);
WindItemRenderer renderer = new WindItemRenderer();
if (tooltips) {
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
}
if (urls) {
renderer.setURLGenerator(new StandardXYURLGenerator());
}
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例15: createHighLowChart
import org.jfree.chart.axis.DateAxis; //导入依赖的package包/类
/**
* 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;
}