简体   繁体   English

如何为jfreechart创建的图表添加缩放功能

[英]how to add zoom functionality to chart created by jfreechart

I have drawn a XY chart using jfree. 我已经使用jfree绘制了XY图表。 Now i want to add zoom functionality to it. 现在,我想为其添加缩放功能。 This must be done using a slider at the bottom of the chart. 必须使用图表底部的滑块完成此操作。 How can i add zoom functionality, the likes of which is present in Windows Photo Viewer? 如何添加Windows Photo Viewer中存在的缩放功能?

Also, i would like to show the current Y-value of the graph as a tooltip when the user hovers his mouse over the plotted line. 另外,当用户将鼠标悬停在绘制的线上时,我想将图形的当前Y值显示为工具提示。 I am not getting much ideas. 我没有太多想法。 Please help. 请帮忙。 Thanks in advance 提前致谢

XYPlot et al. XYPlot 等。 implement the Zoomable interface, which allows ChartPanel to control zooming. 实现Zoomable接口,该接口允许ChartPanel控制缩放。 I'd think you could use these methods in your slider's ChangeListener . 我认为您可以在滑块的ChangeListener使用这些方法。

I would like to show the current Y-value of the graph as a tooltip… 我想显示图形的当前Y值作为工具提示…

You can enable tool tips, as shown in this example . 您可以启用工具提示,如本示例所示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM