Suggestions for Speeding Up Chart Repainting?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ArtieFufkin
Posts: 4
Joined: Tue Feb 26, 2008 9:36 pm

Suggestions for Speeding Up Chart Repainting?

Post by ArtieFufkin » Tue Feb 26, 2008 9:55 pm

Hello,

I have a bit of a dilemma with a Chart App. I'm working on. I have a chart with two series contained in a dataset. The first being a very long series(~100,000 points) and the second being a very coarse approximation of the first (~20 points). You can think of the second series as "sampling" the first.

However, I'm making modifications to the second series and updating the chart by using the following code:

dataset.addSeries("Series 2", series2Vals)

As per the API: this should simply replace the existing Series 2.

Although "Series 2" is very small (less than 20 points), I'm finding that the repaint time is very long, and I'm suspecting that "addSeries" is also repainting my first Series, which I do not want it to do.

My question: Is there anyway to have it only repaint the second Series to speed things up?

Thanks in advance.

ArtieFufkin
Posts: 4
Joined: Tue Feb 26, 2008 9:36 pm

Post by ArtieFufkin » Wed Feb 27, 2008 5:09 am

*EDIT*

I found the sticky on the "Fast plotting" classes so I'll investigate that to see if there's a solution in there.

I also did notice that enabling buffering in the Chart constructor sped things up a bit as well....and I disabled the tool tips.

Still, if anybody has a suggestion on how to update just one series faster, I'd appreciate it.

The more I think about it though, intuitively JFree would probably want to repaint everything anyways since it would have to account for overlapping series, etc.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Feb 28, 2008 4:30 am

JFreeChart will always repaint the whole chart.

I wonder if you could plot your large series in an image (say, BufferedImage), then add that as a background image to the chart/plot? Although you'd run into some pixel scaling issues if the chart's data area changes in size (due to changes in the axis labelling, say, or a resize of the ChartPanel).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

ArtieFufkin
Posts: 4
Joined: Tue Feb 26, 2008 9:36 pm

Post by ArtieFufkin » Thu Feb 28, 2008 4:31 pm

Thanks for the tips. For my application, I found that it works better to just "down sample" the data I'm displaying on screen. I don't need to show each of the 100,000 points, so by reducing it JFreeChart doesn't have to paint as many points to each pixel.

Thanks for the response!

Locked