显示鼠标附近的鼠标坐标作为鼠标移动的提示
在 XYPlot 上,我希望鼠标坐标显示为靠近鼠标的提示,但仅当(鼠标)在图表上移动时!换句话说,当十字准线移动到另一点时,坐标值的定位也会跟随十字准线移动。
此外,还将绘制 1 条水平线和 1 条垂直线,它们在鼠标悬停的点处相交。
这可能吗? 到目前为止,我可以使用 ChartMouseListener 和 ChartMouseMoved 方法获取坐标并打印在控制台上。
这是我的项目以及我想要如何用鼠标绘制图表。
On an XYPlot
, I want the coordinates of mouse displayed as hint near to mouse, but only when (the mouse) move on chart! In another words, when the crosshair moves to another point, the positioning of the coordinate values would move too, following the crosshair.
Also 1 horizontal line and 1 vertical line will be drawn, that intersects specifically at the point that mouse is over on.
Is this possible?
Until now I can get the coordinates and printed on console using ChartMouseListener and chartMouseMoved method.
This is my project and how I want to be the chart with mouse.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
JFreeChart 对十字线有相当灵活的支持。为了执行您所描述的操作,我将在 ChartPanel 上使用 Overlay,并从 ChartMouseListener 更新十字准线。这是一个独立的示例(我将其添加到我们随 JFreeChart 开发人员指南):
JFreeChart has quite flexible support for crosshairs. To do what you described I would use an Overlay on the ChartPanel, and update the crosshairs from your ChartMouseListener. Here is a self-contained example (which I'll add to the collection of demos that we ship with the JFreeChart Developer Guide):