我需要在00:00开始图表并在11:59(24小时)结束 我是JFreeChart的新手,我正在尝试阅读Api,但无法想办法让这项工作成功。
我的数据集从上午00:00到晚上11:59运行,我应该将下限值设置为
我试过了 setLowerbound(开始时间);
这只是继续加载而没有生成图表。
public JFreeChart createLoudnessChart(TimeZone tz,
long startTime,
long endTime,
List<ProgramMetricsData> metrics,
long flowId,
int locationNdx,
String tuple,
int programNum,
String programName,
int pid,
String audioChn,
DVAResourceBundle resourceBundle)
{
JFreeChart jfreechart = ChartFactory.createXYLineChart("", "", "", createDataset(startTime, endTime, metrics, resourceBundle), PlotOrientation.VERTICAL, true, true, false);
XYPlot xyplot = (XYPlot)jfreechart.getPlot();
xyplot.setDomainPannable(true);
xyplot.setRangePannable(true);
DateAxis dt = new DateAxis( resourceBundle.getI18NString("common.hour") );
dt.setTimeZone(tz);
dt.setLabelFont(new Font("simsun", Font.BOLD,12));
dt.setVerticalTickLabels(true);
xyplot.setDomainAxis(dt); //Need to pass TimeZone ....
xyplot.setBackgroundPaint(new Color(249,249,249));
xyplot.setDomainGridlinePaint(Color.GRAY);
xyplot.setRangeGridlinePaint(Color.GRAY);
DateAxis axis = (DateAxis) xyplot.getDomainAxis();
axis.setTimeZone(tz);
axis.setDateFormatOverride(DateFormat.getDateInstance(DateFormat.SHORT));
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
sdf.setTimeZone(tz);
axis.setDateFormatOverride(sdf);
DateTickUnit tickUnit = new DateTickUnit(DateTickUnitType.MINUTE, 30);
axis.setTickUnit(tickUnit);
NumberAxis numberaxis = (NumberAxis)xyplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberaxis.setAutoRangeIncludesZero(true);
numberaxis.setRangeWithMargins(-70.0,0.0);
XYErrorRenderer xyerrorrenderer = new XYErrorRenderer();
xyerrorrenderer.setBaseLinesVisible(true);
xyerrorrenderer.setBaseShapesVisible(false);
xyerrorrenderer.setBaseFillPaint(java.awt.Color.white);
xyerrorrenderer.setSeriesPaint(0, Color.RED);
xyerrorrenderer.setSeriesPaint(1, Color.BLUE);
IQXYToolTipGenerator toolTipGen = new IQXYToolTipGenerator(resourceBundle);
xyerrorrenderer.setBaseToolTipGenerator(toolTipGen);
IQXYURLGenerator urlGenerator = new IQXYURLGenerator(flowId, tuple, programNum, programName, pid, audioChn, locationNdx);
xyerrorrenderer.setURLGenerator(urlGenerator);
xyplot.setRenderer(xyerrorrenderer);
jfreechart.setBackgroundPaint (new Color(239, 243, 250));
jfreechart.setBorderVisible(false);
jfreechart.getLegend().setItemFont(new Font("simsun", Font.BOLD,12));
return jfreechart;
}
任何人都可以帮我一个例子