【问题标题】:JFreeChart - Shared Crosshair between SubplotsJFreeChart - 子图之间的共享十字准线
【发布时间】:2011-05-17 14:57:49
【问题描述】:

我想知道如何共享十字准线。我有一个带有 5 个 XYPlot 的 CombinedXYPlot,当我单击图表时,我希望在每个 SubPlot 上出现一个十字准线。目前,当我点击一个子图时,十字准线只出现在这个子图上:

List<XYPlot> lxyp = t.getSubplots();
        for (XYPlot xyp : lxyp) {
            xyp.setDomainCrosshairVisible(true);
            xyp.setDomainCrosshairLockedOnData(false);
            xyp.setRangeCrosshairVisible(false);
        }

那么,如何改变这个十字准线的颜色和粗细呢?

感谢您的回复!

【问题讨论】:

    标签: java jfreechart subplot


    【解决方案1】:

    我不熟悉CombinedXYPlot,但方法setDomainCrosshairStroke() 可能可用。这提供了BasicStroke 的所有功能。

    subplot1.setDomainCrosshairVisible(true);
    subplot1.setDomainCrosshairPaint(Color.red);
    subplot1.setDomainCrosshairStroke(new BasicStroke(1f));
    ...
    subplot2.setDomainCrosshairVisible(true);
    subplot2.setDomainCrosshairPaint(Color.blue);
    subplot2.setDomainCrosshairStroke(new BasicStroke(1f));
    

    【讨论】:

    • 感谢您的回复垃圾神,但它不起作用。十字准线仍然只出现在我点击的子图上,子图仍然是独立的。
    • 确保在每个子图上设置所需的属性。
    猜你喜欢
    • 1970-01-01
    • 2010-12-11
    • 1970-01-01
    • 1970-01-01
    • 2012-04-07
    • 2019-09-03
    • 2016-02-27
    • 2017-05-14
    • 1970-01-01
    相关资源
    最近更新 更多