JFreeChart:更新图表时保留缩放位置
我的程序使用 JFreeChart(通过 Swing ChartPanel)创建时间序列图表,并允许用户放大它(使用 ChartPanel 的标准缩放功能)。该程序具有可以在运行时调整的参数(例如平滑);如果进行调整,图表将使用 ChartPanel 的“setChart()”方法进行替换。然而,所有调整的时间范围始终保持不变。
当调用“setChart()”时,缩放位置会重置,以便显示整个图表。我现在想要的是在调用“setChart()”后保留缩放位置,以便用户可以直接在任何所需的缩放级别观察调整效果。这怎么可能?
My program creates a time series chart using JFreeChart (via Swing ChartPanel) and allows the user to zoom into it (using the ChartPanel's standard zoom feature). The program has parameters (such as smoothing) that can be tweaked at runtime; if tweaked, the chart is replaced using the ChartPanel's "setChart()" method. The timeframe, however, invariably stays the same across all tweaks.
When "setChart()" is called, the zoom position is reset so that the entire chart is shown. What I now want is for the zoom position to be preserved after the call to "setChart()", so that the user can observe tweak effects directly at any desired zoom level. How is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ChartPanel
具有方法getScaleX()
和getScaleY()
,可用于缓存当前缩放状态,以便以后通过其中一种缩放方法进行恢复。有一个相关示例 在这里。ChartPanel
has methodsgetScaleX()
andgetScaleY()
that could be used to cache the current zoom state for later restoration by one of the zoom methods. There's a related example here.