开发者

Plotting Points in Java with Interaction

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 g开发者_如何学JAVAreat 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.


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.


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.

GraphPanel() {
    ...
    Random rnd = new Random();
    for (int i = 0; i < 2000; i++) {
        Point p = new Point(rnd.nextInt(WIDE), rnd.nextInt(HIGH));
        nodes.add(new Node(p, 4, Color.blue, kind));
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜