Hi Steema -
I'm building an app and trying to set the TChart Axes and Zoom during form Load -
The Set Axes works but not the Zoom -
But if I set the Axes and Zoom with the same code from buttons on the form once loaded it works.
I'm sure it's an event sequencing issue of some sort but can't figure it out.
I distilled the problem reproducing code into a simple one-page c# .net WinForms app to see if it's solvable.
I've also attached some screenshots.
Thanks so much for your help!
Joseph
I only attached the form1 c# code because I couldn't attach the solution rar because it was too large. But if you need the VS2019 Solution ping me.
Set Axis and Zoom in Form Load Wonky
Set Axis and Zoom in Form Load Wonky
- Attachments
-
- Form1.rar
- (712 Bytes) Downloaded 980 times
-
- ClickingWorks.jpg (104.73 KiB) Viewed 10778 times
-
- OnLoadWonky.png (39.93 KiB) Viewed 10778 times
Re: Set Axis and Zoom in Form Load Wonky
Hello,
The chart needs to render before it can run the zoom on what would be the rendered dimensions. You could achieve that this way, removing the call to SetZoom from the initialisation code and adding a one-time call in the Chart OnAfterdraw event:
Regards,
Marc Meumann
The chart needs to render before it can run the zoom on what would be the rendered dimensions. You could achieve that this way, removing the call to SetZoom from the initialisation code and adding a one-time call in the Chart OnAfterdraw event:
Code: Select all
bool hasLoaded = false;
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.IGraphics3D g)
{
if (!hasLoaded)
{
hasLoaded = true;
SetZoom();
}
}
Marc Meumann
Steema Support
Re: Set Axis and Zoom in Form Load Wonky
I will give this a try. Thanks very much Marc!
Re: Set Axis and Zoom in Form Load Wonky
Hi Marc,
I tried the AfterDraw code change you suggested and the Zoom still doesn't work. I tried messing around a little bit with UndoZoom first and DoEvents but still no Zoom using AfterDraw.
I've attached my code in case that's helpful and have the whole VS 2019 Project with just the repro code if it's helpful as well.
Thanks,
Joseph
I tried the AfterDraw code change you suggested and the Zoom still doesn't work. I tried messing around a little bit with UndoZoom first and DoEvents but still no Zoom using AfterDraw.
I've attached my code in case that's helpful and have the whole VS 2019 Project with just the repro code if it's helpful as well.
Thanks,
Joseph
- Attachments
-
- Form1.rar
- (781 Bytes) Downloaded 1048 times