开发者

How to discard time intervals with Time Series / XYPlots using JFreeChart?

I am building a set of chart displays, one of which is for a month display of daily trading - that is, one point of data per day (closing).开发者_如何学JAVA

Since there is no trade during weekends and holidays, I need to discard these data points. Not only that, but data points should still appear adjacent to each other, regardless of any gaps in time. This can be seen in any such chart e.g. in the 3 month graph for Nasdaq on Yahoo Finance - see how weekends are skipped.

My question is: how should one correctly implement this in JFreeChart?

Thanks in advance!


In addition to omitting the excluded data points, you can apply a SegmentedTimeline to the corresponding DateAxis. For example,

axis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());

Although deprecated in the current version, as discussed here, the implementation may guide creation of a custom TimeLine, as noted in a comment here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜