2014-01-22 47 views
3

如在文檔中,說:如何在1中合併2個SegmentedTimelines?

/** 
    * Factory method to create a 15-min, 9:00 AM thought 4:00 PM, Monday 
    * through Friday SegmentedTimeline. 
    * <P> 
    * This timeline uses a segmentSize of FIFTEEN_MIN_SEGMENT_SIZE. The 
    * segment group is defined as 28 included segments (9:00 AM through 
    * 4:00 PM) and 68 excluded segments (4:00 PM through 9:00 AM the next day). 
    * <P> 
    * In order to exclude Saturdays and Sundays it uses a baseTimeline that 
    * only includes Monday through Friday days. 
    * <P> 
    * The <code>startTime</code> of the resulting timeline will be 9:00 AM 
    * after the startTime of the baseTimeline. This will correspond to 9:00 AM 
    * of the first Monday after 1/1/1900. 
    * 
    * @return A fully initialized SegmentedTimeline. 
    */ 
    public static SegmentedTimeline newFifteenMinuteTimeline() 

在此方法中的代碼是: 「timeline.setBaseTimeline(newMondayThroughFridayTimeline());

,如果你只是搜索,其中SegmentedTimeline baseTimeline

被使用,你會看到,這是在3其他方法:

public void addBaseTimelineException(long domainValue) - 它增加了一些例外baseTimeline,

public void addBaseTimelineExclusions(long fromBaseDomainValue, long toBaseDomainValue) - 同樣在這裏,和

public SegmentedTimeline getBaseTimeline()

請注意,此吸氣劑不在其他地方使用。

所以我的問題是,哪裏是實施,允許週末添加segmentedTimeline,這是上面baseTimeTimeline的例外? 摘要:將baseTimeline添加到任何時間線都不起作用。

如何修改該類(SegmentedTimeLine)以創建一個時間軸,這正如盤中 - 但週一至週五,以及每天早上9點至晚上7點?

+0

我知道,我可以將aweekends例外列表添加到我的ie segmentedtimeline = new SegmentedTimeLine(HOUR_SEGMENT_SIZE,8,16),它在週一早上9點開始,但如果我們有3年的數據,性能下降。 –

+0

「,但如果我們有3年的數據,性能就會下降。」 - 抱歉,我的壞,我的渲染器(CandlestickRenderer)被設置爲「setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);」這會降低性能:/ –

回答

1

這是一個SegmentedTimeline的實現問題,它仍然不固定,(更糟糕的)可能不會很快被修復。 project leader said他可能會取消這個功能,或者在未來的JFreeChart版本中實現一個新功能。

作爲一個建議,基於CategoryAxis的圖表可能會幫助您顯示數據集,而不必擔心排除長時間(非交易時間段),儘管您可能需要重寫一些方法來自定義域軸的顯示。請參閱http://www.jfree.org/jfreechart/api/javadoc/src-html/org/jfree/chart/demo/BarChartDemo1.html