How to construct and use TimeSeriesCollections

ぐ巨炮叔叔 提交于 2019-12-06 07:44:35

TimeSeriesCollections are made up of TimeSeries objects

Use this method to add series to the dataset: addSeries(TimeSeries series)

When creating TimeSeries objects. Fill them with the time and values. Here is a rough example:

TimeSeries ts= new TimeSeries("Name of Series");
ts.addOrUpdate(new Year(2008), 42);
ts.addOrUpdate(new Year(2009), 51);
ts.addOrUpdate(new Year(2010), 97);
ts.addOrUpdate(new Year(2011), 45);

For getting the Axis to display the dates nicely, you will have to do something like this:

XYPlot plot = chart.getXYPlot();
DateAxis axis = new DateAxis();
plot.setDomainAxis(axis);
axis.setDateFormatOverride(new SimpleDateFormat("yyyy"));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!