【问题标题】:How to combine 2 SegmentedTimelines in 1?如何将 2 个 SegmentedTimelines 合并为 1 个?
【发布时间】:2014-01-22 13:31:24
【问题描述】:

正如文档中所说:

"

/**
     * 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().

请注意,此 getter 不会在其他任何地方使用。

所以我的问题是,允许将周末作为例外添加到位于baseTimeline 之上的segmentedTimeline 的实现在哪里? 摘要:将 baseTimeline 添加到任何时间线都不会执行任何操作。

如何修改该类 (SegmentedTimeLine) 以制作时间线,类似于盘中 - 但周一到周五,以及每天上午 9 点到晚上 7 点?

【问题讨论】:

  • 我知道,我可以将周末例外列表添加到我的即 segmentedtimeline = new SegmentedTimeLine(HOUR_SEGMENT_SIZE, 8, 16) 中,该列表从周一上午 9 点开始,但如果我们有,则为 3 年的数据,性能下降。
  • "但是如果我们有 3 年的数据,性能就会下降。" - 对不起,我的错,我的渲染器(CandlestickRenderer)设置为“setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);”这会降低性能:/

标签: java jfreechart timeline


【解决方案1】:

这是 SegmentedTimeline 的一个实施问题,尚未修复,(更糟糕的是)可能不会很快得到修复。 project leader said 他可能会取消此功能或在未来的 JFreeChart 版本中实现一个新功能。

作为建议,基于 CategoryAxis 的图表可以帮助您显示数据集,而不必担心排除长(非交易时间段),尽管您可能需要重写一些方法来自定义域轴的显示。见http://www.jfree.org/jfreechart/api/javadoc/src-html/org/jfree/chart/demo/BarChartDemo1.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-29
    • 1970-01-01
    • 2015-03-18
    • 1970-01-01
    • 1970-01-01
    • 2013-11-05
    • 2020-12-06
    相关资源
    最近更新 更多