speed of TColorGridSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
dave novo
Posts: 25
Joined: Tue Oct 23, 2007 12:00 am

speed of TColorGridSeries

Post by dave novo » Thu Feb 05, 2009 7:47 am


We are currently using a TChartSeries to display an image of about 1300x1300 pixels. Its super slow. We have optimized the speed somewhat by exposing the normally private FColors array and adding the colors in one shot by adding to the FColors TList. However, there are still several inefficiencies I would like to inquire about.

In the TColorGrid.SetBitmap method, you assign the FBitmap and then use the .Pixels array to access the pixel values to set the values using addXYZ. The Pixels array is a very slow way to access pixel values. Also, addXYZ is also slower than something like

Code: Select all

XValues.Value := TChartValues(pixelXCoords);

ZValues.Value := TChartValues(pixelZCoords);
where the pixelX and pixelZ are arrays that you build up from a scanline.

In Procedure TColorGridSeries.DrawAllValues - FillBitmap you fill the FBitmap using the scanline. Why do you not do the same thing in the case of setting the bitmap?

The other thing I would like to inquire about is in TColorGridSeries.DrawAllValues - DrawUsingBitmap. The following code:

Code: Select all

if Brush.Style<>bsClear then // 7.05  (somebody asked for this "feature")
refills the bitmap even if the FBitmap was already set in the .SetBitmap method, as long as the brush.style <>bsClear. Is that the point, i.e. if I use .SetBitmap, I should be setting the brush.Style to bsClear in order not to recreate the bitmap again every time the chart is drawn.

Also, you draw all the time with StretchDraw, even though the most charts rarely change size. Would it not be more efficient to cache the drawn image (in the case of drawing from FBitmap, i.e. when IrregularGrid=False) at the final size and then use bitBlt from then on, unless either the FBitmap or the destination size has changed.

Post Reply