使用 Java 处理绘制数据图形

发布于 2024-08-05 05:14:41 字数 118 浏览 4 评论 0原文

我正在考虑用Java 中的Processing (processing.org) 创建一个程序。该程序将涉及绘制大量二维数据的图形。我希望显示的点填满窗口。我查看了他们的库,但没有看到任何数据可视化的内容。我错过了什么吗?

I'm looking at creating a program with Processing (processing.org) in Java. The program will involve graphing a large amount of 2D data. I would like for the points to be displayed to fill the window. I've looked at their libraries and I don't see anything for data visualization. Am I missing something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

尤怨 2024-08-12 05:14:42

JUNG 是我的最爱。

JUNG Is a favorite of mine.

旧话新听 2024-08-12 05:14:42

处理确实非常强大,考虑到您可以非常接近实际的图形编程,可以将其视为“原始”语言。我自己创建了很多图表,可以告诉您在使用这个库时必须非常小心。这很棒,但你必须从头开始做所有事情。这意味着为 x 和 y 轴创建线条、创建标签、创建空间等。

我的建议是设置您最有可能拥有的点数,例如 1000,并始终显示那么多数据。如果您的数据太少或太多,只需在将其发送到图表之前进行调整即可。这样你就永远有一个固定的数字。从这里开始,您要做的事情如下:

pushMatrix();
scale(widthOfGraph/1000, heightOfGraph/numberOfPointsUp);
beginShape(LINES);
for (int i = 0; i < 1000; i++) {
    vertex(x0,y0);
    vertex(x1,y1);
endShape();
popMatrix();

这将在一次绘图操作中创建所有线条,这意味着您将保存大量打开和关闭形状。您还可以使用堆栈矩阵来使用缩放操作来调整画布的显示大小。其他一切都取决于你。希望有帮助。

Processing is really powerful and can be considered a "raw" language given how close you can get to actual graphic programming. I've myself created many graphs and can tell you that you have to be very careful when using this library. It's great but you have to do everything from scratch. This means creating lines for the x and y axis, creating your labels, creating the space, etc.

My suggestion is to set the number of points you'll most likely have, say 1000, and always display with that much data. If you have too little or too much, just adjust it before sending it to graph. This way you'll always have a set number. From here what you do is the following:

pushMatrix();
scale(widthOfGraph/1000, heightOfGraph/numberOfPointsUp);
beginShape(LINES);
for (int i = 0; i < 1000; i++) {
    vertex(x0,y0);
    vertex(x1,y1);
endShape();
popMatrix();

This will create all your lines in a single drawing operation meaning you'll save a lot of opening and closing shapes. You are also using a stack matrix to use the scale operation to adjust the displaying size of your canvas. Everything else is up to you. Hope that helps.

大海や 2024-08-12 05:14:41

我一直使用 JFreechart 或者,将更复杂的图形导出到文本文件,然后 gnuplot

I've always used JFreechart or, for more complex graphing exporting to a text flie and then gnuplot.

画▽骨i 2024-08-12 05:14:41

另一次投票给 JFreeChart。尽管对于更复杂的图形,我已经编写了自己的(AWT)。

another vote for JFreeChart. Although for more complex graphing I've written my own (AWT).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文