动态饼图
我正在寻找一个免费的图表库,可以是 Java、JS 或 Flash,它允许进行向下钻取类型的交互。此类行为的示例可以在 mint.com 的趋势部分找到。 JFreeChart 似乎是用于图表目的的普遍推荐选择,但从对其 API 的浏览来看,似乎没有任何明显的方法来检测特定切片上的鼠标点击并更改图表作为响应。
有关如何使用 JFreeChart 处理此类行为的任何建议,或者如果这不可能,对支持此行为的其他库有何建议?
I am searching for a free charting library, either in Java, JS, or Flash, that allows for drill-down type interaction. An example of this sort of behavior can be found in the trends section on mint.com. JFreeChart seems like the generally recommended choice for charting purposes, but from a little browsing of their API there doesn't seem to be any obvious way to detect mouse clicks on a particular slice and change the chart in response.
Any advice on how to handle this sort of behavior using JFreeChart, or if this is not possible any recommendations for other libraries that do support this behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于您打算在何处使用图表。
对于基于 Swing 的应用程序,在 ChartPanel 可以很好地处理 鼠标事件您可以根据自己的喜好进行更新。
对于将图表呈现为图像的网页,您可以生成 客户端图像映射 与图表一起使用,并使用 AJAX 根据需要重新生成和替换图像。
不过,更简单的选择可能是使用 Flot 进行动态图表。查看他们的交互式示例并确定它是否适合您的需求。
编辑 糟糕,我没有注意到您专门询问饼图。但是,您可以在饼图上进行什么样的“向下钻取”操作?
That depends on where you intend to use the chart.
For Swing-based application, chart drawn within ChartPanel can very much handle mouse events and you can update it to your heart's content.
For a web page where chart is being rendered as image, you can generate a client side image map to accompany the chart and, using AJAX, re-generate and replace the image as needed.
However, the easier option is perhaps to use Flot for dynamic charting. Take a look at their interactive examples and decide whether that suits your needs.
Edit Oops, I didn't notice that you were asking about pie charts specifically. What kind of "drill-down" can you do on pie chart, though?
为什么不使用谷歌可视化API?
它是免费的。
通过 Google CDN 快速提供服务,因此不会占用您的任何带宽。
通过
例如,您可以查看 http://geognos.appspot .com/geo/en/cc/gr.html#经济
why not use Google Visualisation API ?
It is free.
Served fast from Google CDN so it does not take any of your bandwidth.
For an example may you take a look at http://geognos.appspot.com/geo/en/cc/gr.html#Economy