I'm doing a progressive draw of the chart and it's a pretty complex chart, it's slow but it works.
The dataset has a scaler factor which scales the getY result and does a firedatasetchanged().
I set a chartprogresslistener for the DRAWING_FINISHED event and set the next scaler, until the dataset is returning full normal values.
When I create the chart w/ bufferedimage true, then the chartprogresslistener no longer get's DRAWING_FINISHED events, as a result of the firedatasetchanged().
any chance this is a bug or am I missing something w/ the drawing and buffered image?
thanks,
andrew
oddity w/ bufferedimage chart and firedatasetchanged()
-
- Posts: 36
- Joined: Thu Apr 12, 2007 6:54 am
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Sounds like a bug - any hints to reproduce? A self-contained demo would be a great help.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 36
- Joined: Thu Apr 12, 2007 6:54 am
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
In the paintComponent() method in the ChartPanel class, find this block of code:
Try moving the 'this.refreshBuffer = false' up to the start of the block. I suspect your code is is triggering a ChartChangeEvent (which sets refreshBuffer to true) at the previous line (this.chart.draw(...)), and then we're resetting the flag which prevents any further chart refresh.
Code: Select all
// do we need to redraw the buffer?
if (this.refreshBuffer) {
Rectangle2D bufferArea = new Rectangle2D.Double(
0, 0, this.chartBufferWidth, this.chartBufferHeight);
Graphics2D bufferG2 = (Graphics2D)
this.chartBuffer.getGraphics();
if (clearBuffer) {
bufferG2.clearRect(0, 0, this.chartBufferWidth,
this.chartBufferHeight);
}
if (scale) {
AffineTransform saved = bufferG2.getTransform();
AffineTransform st = AffineTransform.getScaleInstance(
this.scaleX, this.scaleY);
bufferG2.transform(st);
this.chart.draw(bufferG2, chartArea, this.anchor,
this.info);
bufferG2.setTransform(saved);
}
else {
this.chart.draw(bufferG2, bufferArea, this.anchor,
this.info);
}
this.refreshBuffer = false;
}
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 36
- Joined: Thu Apr 12, 2007 6:54 am
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I committed the fix to Subversion for inclusion in the 1.0.7 release.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

