Page 1 of 1

Repaint

Posted: Tue Nov 22, 2005 2:00 pm
by 9639216
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

Posted: Tue Nov 22, 2005 3:02 pm
by narcis
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.

Invalidate does not work

Posted: Tue Nov 22, 2005 4:18 pm
by 9639216
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

Posted: Tue Nov 22, 2005 5:26 pm
by narcis
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(); 

ASP.NET application

Posted: Wed Nov 23, 2005 2:09 pm
by 9639216
Hey Narcis!

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

Werner

Posted: Thu Nov 24, 2005 1:27 pm
by narcis
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;
		}

Posted: Thu Nov 24, 2005 1:35 pm
by 9639216
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

Posted: Thu Nov 24, 2005 2:20 pm
by narcis
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;
			}
		}