AFreeChart OHLCDataset:如何删除日期轴上没有数据的空格?

时间:2013-03-13 09:13:16

标签: java android charts jfreechart candlestick-chart

3月9日至10日没有数据,是否有可能在这段时间之间消除空间?

OHLC chart

1 个答案:

答案 0 :(得分:4)

如果周末数据产生差距,你可以做这样的事情

SegmentedTimeline timeline = SegmentedTimeline.newMondayThroughFridayTimeline();
((DateAxis) chart.getXYPlot().getDomainAxis()).setTimeline(timeline);

final OHLCDataset dataset = new DefaultOHLCDataset("Series1", ohlc);
SegmentedTimeline timeline = SegmentedTimeline.newMondayThroughFridayTimeline();
chart = ChartFactory.createHighLowChart(this.getTitle(),xLabel, yLabel,dataset,timeline, false);

如果不是周末,那么SegmentedTimeline api

你必须更加聪明一点

http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/SegmentedTimeline.html