Page 1 of 1

Textlabel at colorline

Posted: Thu Feb 16, 2006 11:24 am
by 9238293
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?

Posted: Thu Feb 16, 2006 11:58 am
by narcis
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);
		}

Posted: Thu Feb 16, 2006 12:58 pm
by 9238293
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?

Posted: Thu Feb 16, 2006 3:01 pm
by narcis
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;
		}