用 Java 绘制图形
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1277126/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Plot Graphs in Java
提问by tamizhan
The Java Swing GUI that I'm developing needs to plot a 2D graph based on the x and y coordinates generated in the program.
我正在开发的 Java Swing GUI 需要根据程序中生成的 x 和 y 坐标绘制二维图形。
Is there a Swing component for that?
是否有一个 Swing 组件?
Or is there any other open source package for the purpose?
或者是否有任何其他开源包用于此目的?
采纳答案by Olly
You should check out JFreeChartwhich has Swing support. Here are some samples:
您应该查看支持 Swing 的JFreeChart。以下是一些示例:
回答by Mark
You should look at JFreeChart.
你应该看看JFreeChart。
回答by n002213f
check out the feature comparison for Java report and charting libraries; http://java-source.net/open-source/charting-and-reporting
查看 Java 报告和图表库的功能比较;http://java-source.net/open-source/charting-and-reporting
回答by timaschew
Here is a related answer of me: I have summary of existing tools and show a alternative option to create interactive charts with Gnuplot in a JPanel
这是我的相关答案:我总结了现有工具并展示了在 JPanel 中使用 Gnuplot 创建交互式图表的替代选项
For your case (2d charts) JFreeChart is OK. But sometimes JFreeChart is overkill for simple charts.
对于您的情况(二维图表),JFreeChart 是可以的。但有时 JFreeChart 对于简单的图表来说太过分了。