问题描述
我以前从未使用过JFreeChart.有人告诉我,这是用Java绘制图表的不错的产品.
I've never used JFreeChart before. It has been told me that it's a pretty good product for drawing charts in Java.
我有一个疑问,我想向已经有JFreeChart经验的人提出一些建议:
I have a doubt, and I would like to have some advices by someone that has already some JFreeChart experience:
JFreeChart是否仅设计用于显示静态的预先计算的值集?
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:
- 单击显示的图表(例如折线图),然后确定显示的数据集的较近点.
- 使用某种拖动事件根据鼠标的移动来更改数据集的值
- 以交互方式显示更新的图表
推荐答案
JFreeChart
可以当然可以处理动态图表,如此处所示;并且您可以通过多种方式与现有图表进行交互,如.
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:
-
当您将鼠标悬停在某个点上时,默认的工具提示生成器会显示数据,但您也可以提供自定义生成器.
The default tooltip generator displays data when you hover over a point, but you can also supply a custom generator.
ChartPanel
同时实现MouseListener
和MouseMotionListener
.
JWS演示是一个宝库的例子,很多互动. crosshair
演示特别吸引人.
The JWS demo is a trove of examples, many interactive. The crosshair
demos are particularly appealing.
这篇关于jfreechart关于交互地修改显示的曲线拖动鼠标的可能性的一般性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!