Repaint

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Werner
Newbie
Newbie
Posts: 29
Joined: Mon Nov 14, 2005 5:00 am

Repaint

Post by Werner » Tue Nov 22, 2005 2:00 pm

Hi!

I am starting again with straight questions, which are still unanswered:

Is it possible to repaint the whole chart at any time of the creation (e.g. in GetAxisLabel)?

Werner

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 22, 2005 3:02 pm

Hi Werner,

Yes, this is possible, but be careful not to enter in a endless loop as AfterDraw event (self explainatory) is fired. To force a chart being drawn you can use tChart1.Invalidate(). You can also play with tChart1.Autorepaint property.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Werner
Newbie
Newbie
Posts: 29
Joined: Mon Nov 14, 2005 5:00 am

Invalidate does not work

Post by Werner » Tue Nov 22, 2005 4:18 pm

I tried WebChartProdukt.Chart.Invalidate(); in WebChartProdukt_GetBottomAxisDrawLabel

but with no effect.

WebChartProdukt_GetBottomAxisDrawLabel is only called once and the labels are not redrawn.

Would should the AutoRepaint value do? Could that be help in my case?
I tried searching in the Feature demo for AutoRepaint, but all I got was Realtime charting. When I start this, the feature demo freezes and I had a hard time killing it. No chance to see the source code of this.

Any other suggestions?

Werner

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 22, 2005 5:26 pm

Hi Werner,

Use AutoRepaint false to disable Chart repainting whilst (for example) adding a large number of points to a Chart Series. This avoids repainting of the Chart whilst the points are added. AutoRepaint may be re-enabled, followed by a manual Repaint command when all points are added.

Example:

Code: Select all

tChart1.AutoRepaint = false; 
Random r = new Random(); 
for(int i = 0; i <500; i++)
{
      tChart1[0].Add (i,r.Next(800),Color.Blue); 
} 
tChart1.AutoRepaint = true; 
tChart1.Refresh(); 
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Werner
Newbie
Newbie
Posts: 29
Joined: Mon Nov 14, 2005 5:00 am

ASP.NET application

Post by Werner » Wed Nov 23, 2005 2:09 pm

Hey Narcis!

Do you know that we are talking about a web application?
So refresh simple is not available...
Any other ideas?

Werner

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 24, 2005 1:27 pm

Hi Werner,

The code below works fine in web applications. Setting AutoRepaint=true makes WebChart being internally repainted.

Code: Select all

		private void Page_Load(object sender, System.EventArgs e)
		{
			WebChart1.Chart.AutoRepaint=false;
			Random r = new Random();
			for(int i = 0; i <500; i++)	WebChart1.Chart.Series[0].Add(i,r.Next(),Color.Red);
			WebChart1.Chart.AutoRepaint=true;
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Werner
Newbie
Newbie
Posts: 29
Joined: Mon Nov 14, 2005 5:00 am

Post by Werner » Thu Nov 24, 2005 1:35 pm

If I do:

Code: Select all

private void WebChartProdukt_GetBottomAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
{
        [...]
	if({Label overlaps with previous})
	{
		WebChartProdukt.Chart.AutoRepaint = false;
		WebChartProdukt.Chart.Axes.Bottom.Labels.Angle = 90;
		WebChartProdukt.Chart.AutoRepaint = true;
	}
}
the labels in the WebChart are not repainted.
Are there other ways to repaint the labels?

Nice regards
Werner

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Nov 24, 2005 2:20 pm

Hi Werner,

It works fine here using GetAxisLabel event without the need of forcing the chart being repainted:

Code: Select all

		private void WebChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
		{
			if (sender==WebChart1.Chart.Axes.Bottom) 
			{
				WebChart1.Chart.Axes.Bottom.Labels.Angle=90;
			}
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply