Community
Participate
Working Groups
Build Identifier: Version: 3.7.1 M20110909-1335 My understanding is to speed up redraw of a chart, Generator.refresh() should be called instead of Generator.build(...). But the examples call refresh and then build. See the plugin org.eclipse.birt.chart.examples in the source folder org.eclipse.birt.chart.examples.api.viewer.SwtLiveChartViewer. Note that after refresh is called, a redraw is done. Redraw calls paintControl(). paintControl() always does a Generator.build(). Build() doesn't take the state updated by refresh, it just throws it away and rebuilds a whole new state (The variable gcs in the code below.) From the example code: private void chartRefresh( ){ ... final Generator gr = Generator.instance( ); scrollData( (ChartWithAxes) cm ); // Refresh try { gr.refresh( gcs ); } catch( ChartException ex ){ ex.printStackTrace( ); } redraw( ); ... } --------------- I tried modifying the example so build() is only done the first time. But in this case the axes redraw but the data does not. The code below shows the modification I made. The behavior of the modified example matches the behavior of the project I was working on where I discovered this problem. public final void paintControl( PaintEvent e ) { Rectangle d = this.getClientArea( ); if ( bFirstPaint ) { imgChart = new Image( this.getDisplay( ), d ); gcImage = new GC( imgChart ); idr.setProperty( IDeviceRenderer.GRAPHICS_CONTEXT, gcImage ); bo = BoundsImpl.create( 0, 0, d.width, d.height ); bo.scale( 72d / idr.getDisplayServer( ).getDpiResolution( ) ); } Generator gr = Generator.instance( ); try { if (bFirstPaint) //++++ added this line. But then data does not redraw. gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, null, null ); gr.render( idr, gcs ); GC gc = e.gc; gc.drawImage( imgChart, d.x, d.y ); } catch ( ChartException ce ){ ce.printStackTrace( ); } bFirstPaint = false; Display.getDefault( ).timerExec( 1, new Runnable( ) { public void run( ){ chartRefresh( ); } } ); } Reproducible: Always Steps to Reproduce: 1. Use Eclipse File/Import/plugins and fragments 2. Import org.eclipse.birt.chart.examples. 3. Run org.eclipse.birt.cahrt.examples.api.viewer.SwtLiveCharViewer. 4. Modify paintControl as shown above. 5. Rerun the example and notice the axes update, but the data does not.
Recalculate data points for each series in Generator.refresh() method and fixed this problem.
See #comment1. If the issue still exists for you, please feel free to reopen the bug with more details on how to reproduce.