Textlabel at colorline

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Arnold Douma
Newbie
Newbie
Posts: 2
Joined: Tue Sep 13, 2005 4:00 am

Textlabel at colorline

Post by Arnold Douma » Thu Feb 16, 2006 11:24 am

Hi,

I want to draw some vertical ines with a text-label. I've tried to use the anotation, but this won't move during zooming/scrolling.

Can someone help?

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 Feb 16, 2006 11:58 am

Hi Arnold,

Yes, I'd suggest you to use ColorLine tool and custom draw the text line on TChart's canvas doing something like:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			points1.FillSampleValues();
		
			colorLine1.Axis=tChart1.Axes.Bottom;
			colorLine1.Value=points1.XValues[5];
		}

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			tChart1.Graphics3D.RotateLabel(points1.CalcXPosValue(colorLine1.Value),tChart1.Height/2,"ColorLine 1",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

Arnold Douma
Newbie
Newbie
Posts: 2
Joined: Tue Sep 13, 2005 4:00 am

Post by Arnold Douma » Thu Feb 16, 2006 12:58 pm

Thanks!

Now i have the following problem
after the next code:

Line := TColorLineTool.Create(self);
Line.ParentChart := TraceChart;
Line.Axis := TraceChart.BottomAxis;
Line.Value := 3.6;

The line is displayed nicely on 3.6. But moving around appears to move the line too. It looks like when moving the line 'out the window' it sticks to the border of the chart.

Is this a bug?

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 Feb 16, 2006 3:01 pm

Hi Arnold,

No, this is not a bug, this is as designed. However, to achieve the behaviour you request you can improve the code before by doing something like:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			points1.FillSampleValues();
		
			colorLine1.Axis=tChart1.Axes.Bottom;
			colorLine1.Value=points1.XValues[5];
		}

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			if ((tChart1.Axes.Bottom.Minimum<colorLine1.Value) && (tChart1.Axes.Bottom.Maximum>colorLine1.Value)) 
				tChart1.Graphics3D.RotateLabel(points1.CalcXPosValue(colorLine1.Value),tChart1.Height/2,"ColorLine 1",90);
		}

		private void tChart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if ((tChart1.Axes.Bottom.Minimum>colorLine1.Value) || (tChart1.Axes.Bottom.Maximum<colorLine1.Value)) 
				colorLine1.Active=false;
			else colorLine1.Active=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

Post Reply