在 Java 中通过交互绘制点
我有大量数据点,它们是具有非整数值(浮点数)的二维坐标。我正在寻找一个 Java 库,可以帮助我绘制这些点,允许自定义点大小、颜色和标签。此外,我希望用户能够通过平移和缩放与点进行交互,并且我希望能够捕获用户的 KeyEvent。
处理看起来很适合我想要的,但我不想从头开始做所有事情。有更好的解决方案吗?
提前致谢。
编辑:大约有2k点。
I have a large number of data points which are two dimensional coordinates with non-integer values (floats). I am looking for a Java library that can help me plot these points, allowing for custom point size, color, and labels. Further, I would like the user to be able to interact with the points with panning and zooming, and I want to be able to capture KeyEvents from the user.
Processing looks great for what I want, but I don't want to do everything from scratch. Is there a better solution?
Thanks in advance.
Edit: There are about 2k points.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
视情况而定。我最近制作了一个使用 JFreechart 显示大型二维数据集的应用程序,但我最终将数据集变小以提高性能。
我显示了点矩阵,这些点矩阵随时间变化(当新数据到达时),刷新时间为 1 秒(因此每隔一秒图表就会重新绘制一次)。
对于 256 x 256 的矩阵,在普通用户计算机上是可以的。如果矩阵是 ~350 点,它会变得粗糙(用户在 GUI 中看到滞后),但它是可用的,如果矩阵是 1024 x 1024 应用程序不可用。
我在 EDT 中绘制了图表,但即使我将其放入不同的线程中 — 渲染仍然会消耗处理器的电量。
因此,根据数据集大小 --- 您可能想要使用 JFreeChart。
Depends. I recently did app that displays large 2d datasets with JFreechart, but I ended making datasets smaller to have performance.
I displayed matrices of points, that changed in time (when new data arrives) with 1 second refresh time (so every one second chart is repainted).
For matries 256 x 256 it is OK on normal user computer. If the matrix is ~350 pts it gets rough (user sees lags in the GUI), but it is usable, if the matrix is 1024 x 1024 app is unusable.
I did chart drawing ind EDT, but still even if I took it into different thread --- rendering would still eat processor power.
So depending on data set size --- you might want to use JFreeChart.
我还没有找到一个适合大型数据集的好库。
当你说大时,你的意思是什么? 1k、100k 还是 100 万点?
我刚刚推出了自己的数据集,因为我的数据集至少有 100k 点。我尝试了所有能找到的图表库,但没有一个比我自己构建的图表库快。
I haven't found a good library that works well for large data sets.
When you say large what do you mean? 1k, 100k, or 1 million points?
I just rolled my own since my data sets were at least 100k points. I've tried all the charting libraries I could find but none of them were as fast the one I rolled on my own.
此示例可以轻松处理数千个节点。
This example easily handles thousands of nodes.