jfreechart general issue on the possibility of interactlively modify a displayed curve dragging mouse

和自甴很熟 提交于 2021-02-10 03:24:17

问题


I've never used JFreeChart before. It has been told me that it's a pretty good product for drawing charts in Java.

I have a doubt, and I would like to have some advices by someone that has already some JFreeChart experience:

is JFreeChart designed only for display static precomputed set of values?

Or is there any "pretty easy" way to handle mouse event (possibly dragging) in order to dynamically change the displayed curves (and consequentely the associated data set)?

With "pretty easy" I mean been able to do the following without having to write too much lines of code:

  1. Click on a displayed chart (for example Line Chart ) and identify the closer point of the dataset displayed .
  2. Use some sort of drag event to change the dataset value according to the movement of the mouse
  3. Show the updated chart interactively

回答1:


JFreeChart can certainly handle dynamic charts, as shown here; and you can interact in a variety of ways with an existing chart, as shown here.

Addendum: Here's a few more specifics:

  1. The default tooltip generator displays data when you hover over a point, but you can also supply a custom generator.

  2. ChartPanel implements both MouseListener and MouseMotionListener.

  3. The JWS demo is a trove of examples, many interactive. The crosshair demos are particularly appealing.



来源:https://stackoverflow.com/questions/6337851/jfreechart-general-issue-on-the-possibility-of-interactlively-modify-a-displayed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!