Help wanted overcoming delay in repainting contour graph
Posted: 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.
The problem is that, when the graph first appears, the axes are not scaled properly, as shown here:
I have put the code that adjusts the scales AND draws the circles is the chart's AfterDraw event handler:
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
The problem is that, when the graph first appears, the axes are not scaled properly, as shown here:
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
}
}
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