This isn’t a for a game, but for plotting points in a graph. I’m hoping the problem is similar to what someone else might have encountered in a 2D game.
Basically I’ve got a JPanel subclass (in a Swing GUI application) with a custom paintComponent() method to draw the plots, axes, labels, etc.
Currently I’d like to plot a large number of points on a plot at once time (say, greater than 1000 points at a time). These are typically drawn as circles and may also have lines connecting points.
When the number of points increases, the time to re-draw the plot increases (I guess this is a “duh”), but I am wondering if there is a better way (performance-wise) to draw this.
One thought is to draw the plot on an image of some sort, then the overhead for the scaling etc. of drawing isn’t there for later re-draws. This would work fine for static display of data, but I also need to deal with the case where new data is added to the graph (forcing old data either to be compressed or moved off one end of the plot), so the image would also need to be updated.
I’ve got some ways around this (limiting the number of points to plot, using “summary” plots like histograms), but users want to “push the system” and display more data than is “reasonable” (from the developer’s point of view :)), so I am trying to account for this.
Switching to another framework (i.e., SWT) isn’t an option - maybe sometime down the road (if needed), but for now, it has to be Swing.
Thanks,
Greg