Clicking on TChart Causes BeforeSeries to Fire (but it didn't used to)

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jzarech
Newbie
Newbie
Posts: 59
Joined: Mon Jul 07, 2008 12:00 am

Clicking on TChart Causes BeforeSeries to Fire (but it didn't used to)

Post by jzarech » Fri Jun 27, 2025 6:25 am

I'm upgrading a 2008 app that uses TChart extensively.

When I draw the chart, it takes about 30 seconds to draw a bunch of custom lines on the canvas, which I do in the BeforeDrawSeries event, so the lines are under the stock prices.

In the old 2008 version of the app, clicking on the chart didn't trigger the BeforeDrawSeries event (or any of the 4 drawing events) to fire, so it didn't erase all the custom drawings, ie, it was very user-friendly.

The new version fires all 4 drawing events only if there's a price series on the chart (which there is). So if the user clicks on the chart, it takes 30 seconds for each click to redraw all the custom drawings.

In the 2008 version (using VB.NET), this behaviour didn't exist.

I opened a bug and thought I'd post the sample app here - notice that in the sample app if you remove the price series from the chart the problem goes away. No events fired when you click on the chart and custom drawing is not erased. But add a price series, and the 4 draw events that erase all the custom data are fired.

I hope there's a simple workaround besides telling my users they're young and 30 seconds each click won't kill them (well eventually it will, but not right away).

Thanks very much,

Joseph

Marc
Site Admin
Site Admin
Posts: 1316
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Clicking on TChart Causes BeforeSeries to Fire (but it didn't used to)

Post by Marc » Fri Jun 27, 2025 3:12 pm

Hello Joseph,

I took a look at the bug report here and used the example project to arrive at a suggestion. Please review:

#2772

With thanks.
Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1316
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Clicking on TChart Causes BeforeSeries to Fire (but it didn't used to)

Post by Marc » Fri Jun 27, 2025 3:26 pm

..as a followup, the suggestion to avoid the repaint on click:

Code: Select all

private void tChart1_Click(object sender, EventArgs e)
{
    tChart1.AutoRepaint = false;
    this.Text = "Click shouldn't cause a redraw." + DateTime.Now.ToString();
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
    tChart1.AutoRepaint = true;
}
private void tChart1_Zoomed(object sender, EventArgs e)
{
    tChart1.AutoRepaint = true;
}
Steema Support

Post Reply