本文整理汇总了Java中org.jfree.chart.axis.DateAxis.setTimeZone方法的典型用法代码示例。如果您正苦于以下问题:Java DateAxis.setTimeZone方法的具体用法?Java DateAxis.setTimeZone怎么用?Java DateAxis.setTimeZone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.axis.DateAxis
的用法示例。
在下文中一共展示了DateAxis.setTimeZone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePlotter
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
int categoryCount = prepareData();
String maxClassesProperty = ParameterService
.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
int maxClasses = 20;
try {
if (maxClassesProperty != null) {
maxClasses = Integer.parseInt(maxClassesProperty);
}
} catch (NumberFormatException e) {
// LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.",
// LogService.WARNING);
LogService.getRoot().log(Level.WARNING,
"com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
}
boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;
JFreeChart chart = createChart(this.dataset, createLegend);
// set the background color for the chart...
chart.setBackgroundPaint(Color.white);
// domain axis
if (axis[INDEX] >= 0) {
if (!dataTable.isNominal(axis[INDEX])) {
if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
domainAxis.setTimeZone(Tools.getPreferredTimeZone());
chart.getXYPlot().setDomainAxis(domainAxis);
if (getRangeForDimension(axis[INDEX]) != null) {
domainAxis.setRange(getRangeForDimension(axis[INDEX]));
}
domainAxis.setLabelFont(LABEL_FONT_BOLD);
domainAxis.setTickLabelFont(LABEL_FONT);
domainAxis.setVerticalTickLabels(isLabelRotating());
}
} else {
LinkedHashSet<String> values = new LinkedHashSet<String>();
for (DataTableRow row : dataTable) {
String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
if (stringValue.length() > 40) {
stringValue = stringValue.substring(0, 40);
}
values.add(stringValue);
}
ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]),
values.toArray(new String[values.size()]));
categoryAxis.setLabelFont(LABEL_FONT_BOLD);
categoryAxis.setTickLabelFont(LABEL_FONT);
categoryAxis.setVerticalTickLabels(isLabelRotating());
chart.getXYPlot().setDomainAxis(categoryAxis);
}
}
// legend settings
LegendTitle legend = chart.getLegend();
if (legend != null) {
legend.setPosition(RectangleEdge.TOP);
legend.setFrame(BlockBorder.NONE);
legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
legend.setItemFont(LABEL_FONT);
}
AbstractChartPanel panel = getPlotterPanel();
if (panel == null) {
panel = createPanel(chart);
} else {
panel.setChart(chart);
}
// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
panel.getChartRenderingInfo().setEntityCollection(null);
}
示例2: updateDomainAxis
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
private void updateDomainAxis(TimeZone displayTimeZone, Locale locale) {
DateAxis domainAxis = getDomainAxis();
if (displayTimeZone != null) {
String abbrTimeZoneStr = displayTimeZone.getDisplayName(displayTimeZone.useDaylightTime(), TimeZone.SHORT);
String label = "Time (" + abbrTimeZoneStr + ")";
domainAxis.setLabel(label);
domainAxis.setTimeZone(displayTimeZone);
}
if (locale != null) {
domainAxis.setLocale(locale);
}
}
示例3: updatePlotter
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@Override
protected void updatePlotter() {
int categoryCount = prepareData();
String maxClassesProperty = ParameterService.getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT);
int maxClasses = 20;
try {
if (maxClassesProperty != null)
maxClasses = Integer.parseInt(maxClassesProperty);
} catch (NumberFormatException e) {
//LogService.getGlobal().log("Series plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", LogService.WARNING);
LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.SeriesChartPlotter.parsing_property_error");
}
boolean createLegend = categoryCount > 0 && categoryCount < maxClasses;
JFreeChart chart = createChart(this.dataset, createLegend);
// set the background color for the chart...
chart.setBackgroundPaint(Color.white);
// domain axis
if (axis[INDEX] >= 0) {
if (!dataTable.isNominal(axis[INDEX])) {
if (dataTable.isDate(axis[INDEX]) || dataTable.isDateTime(axis[INDEX])) {
DateAxis domainAxis = new DateAxis(dataTable.getColumnName(axis[INDEX]));
domainAxis.setTimeZone(Tools.getPreferredTimeZone());
chart.getXYPlot().setDomainAxis(domainAxis);
if (getRangeForDimension(axis[INDEX]) != null)
domainAxis.setRange(getRangeForDimension(axis[INDEX]));
domainAxis.setLabelFont(LABEL_FONT_BOLD);
domainAxis.setTickLabelFont(LABEL_FONT);
domainAxis.setVerticalTickLabels(isLabelRotating());
}
} else {
LinkedHashSet<String> values = new LinkedHashSet<String>();
for (DataTableRow row : dataTable) {
String stringValue = dataTable.mapIndex(axis[INDEX], (int) row.getValue(axis[INDEX]));
if (stringValue.length() > 40)
stringValue = stringValue.substring(0, 40);
values.add(stringValue);
}
ValueAxis categoryAxis = new SymbolAxis(dataTable.getColumnName(axis[INDEX]), values.toArray(new String[values.size()]));
categoryAxis.setLabelFont(LABEL_FONT_BOLD);
categoryAxis.setTickLabelFont(LABEL_FONT);
categoryAxis.setVerticalTickLabels(isLabelRotating());
chart.getXYPlot().setDomainAxis(categoryAxis);
}
}
// legend settings
LegendTitle legend = chart.getLegend();
if (legend != null) {
legend.setPosition(RectangleEdge.TOP);
legend.setFrame(BlockBorder.NONE);
legend.setHorizontalAlignment(HorizontalAlignment.LEFT);
legend.setItemFont(LABEL_FONT);
}
AbstractChartPanel panel = getPlotterPanel();
if (panel == null) {
panel = createPanel(chart);
} else {
panel.setChart(chart);
}
// ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!!
panel.getChartRenderingInfo().setEntityCollection(null);
}
示例4: configureChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
@Override
public void configureChart(JFreeChart chart) {
// this setup is required before any data is in the chart
// or auto ranging on the y-axis breaks
if (app.getBooleanProperty("chartRelativeTime")) {
LineChartBuilder.setRelativeAxis(chart, app.getMinSystemTime());
}
else {
LineChartBuilder.setAbsoluteAxis(chart);
}
DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis();
Interval current = app.getIntervalManager().getCurrentInterval();
axis.setTimeZone(app.getDisplayTimeZone());
if (chart.getXYPlot().getRenderer().getBaseToolTipGenerator().getClass() == TimeAndValueTooltipGenerator.class) {
((TimeAndValueTooltipGenerator) chart.getXYPlot().getRenderer().getBaseToolTipGenerator()).setTimeZone(app
.getDisplayTimeZone());
}
if (Interval.DEFAULT.equals(current)) {
if (app.getMinSystemTime() == 0) {
// implies no current datasets, so keep the axis range sane
// fixes near infinite loop displaying chart with no data
long now = System.currentTimeMillis();
axis.setRange(now - (86400000 / 2), now + ((86400000 - 1000) / 2));
}
else {
long min = app.getMinSystemTime();
long max = app.getMaxSystemTime();
// exception thrown if min and max are the same
if (min == max) {
min -= 1000;
}
axis.setRange(min, max);
}
}
else {
axis.setRange(current.getStart(), current.getEnd());
}
}
示例5: renderPreChart
import org.jfree.chart.axis.DateAxis; //导入方法依赖的package包/类
protected JFreeChart renderPreChart(Map<String, OXFFeatureCollection> entireCollMap, String[] observedProperties,
ArrayList<TimeSeriesCollection> timeSeries, Calendar begin, Calendar end) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(null, // title
"Date", // x-axis label
observedProperties[0], // y-axis label
timeSeries.get(0), // data
true, // create legend?
true, // generate tooltips?
false // generate URLs?
);
chart.setBackgroundPaint(Color.white);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
renderer.setBaseShapesVisible(true);
renderer.setBaseShapesFilled(true);
// add additional datasets:
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setRange(begin.getTime(), end.getTime());
axis.setDateFormatOverride(new SimpleDateFormat());
axis.setTimeZone(end.getTimeZone());
for (int i = 1; i < observedProperties.length; i++) {
XYDataset additionalDataset = timeSeries.get(i);
plot.setDataset(i, additionalDataset);
plot.setRangeAxis(i, new NumberAxis(observedProperties[i]));
// plot.getRangeAxis(i).setRange((Double)
// overAllSeriesCollection.getMinimum(i),
// (Double) overAllSeriesCollection.getMaximum(i));
plot.mapDatasetToRangeAxis(i, i);
// plot.getDataset().getXValue(i, i);
}
return chart;
}