Help wanted overcoming delay in repainting contour graph

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Geocentrix
Newbie
Newbie
Posts: 3
Joined: Thu Sep 30, 2021 12:00 am

Help wanted overcoming delay in repainting contour graph

Post by Geocentrix » Thu Apr 17, 2025 1:27 pm

I am trying to create a contour graph that uses ISO axes (i.e. the same X and Y scales) AND has a number of circles drawn on top of it. Screenshot #2 (correct) below shows the graph I am trying to produce.
Screenshot 2 (correct).jpg
Screenshot 2 (correct).jpg (111.84 KiB) Viewed 149 times
The problem is that, when the graph first appears, the axes are not scaled properly, as shown here:
Screenshot 1 (wrong).jpg
Screenshot 1 (wrong).jpg (127.84 KiB) Viewed 149 times
I have put the code that adjusts the scales AND draws the circles is the chart's AfterDraw event handler:

Code: Select all

void __fastcall TGxGraphPaper::TeeChartAfterDraw(TObject *Sender)
{
	if(auto plot = dynamic_pointer_cast<BoundaryElementContourPlot, TeeGraph>(contour_graph)) {
		// adjust the axes
		plot->MakeIsoAxis();    // THIS CALL ADJUSTS THE AXES

		// draw the piles
		if(auto analysis = dynamic_pointer_cast<const Repute::BoundaryElementAnalysis>(data))
			plot->DrawPileGroup(*analysis.get());    // THIS CALL DRAWS THE CIRCLES
	}
}
The strange thing is the WRONG drawing displays the circles, so has clearly gone through the AfterDraw event.

It is only when I move the mouse over the drawing that the graphs flashes and then displays the CORRECT drawing, without going through AfterDraw a second time.

Can anyone please explain what is happening here? What am I missing?

Thanks in advance.

Andrew Bond

Post Reply