Add DrawLineItem from code

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
stratadat
Newbie
Newbie
Posts: 13
Joined: Mon Feb 13, 2006 12:00 am

Add DrawLineItem from code

Post by stratadat » Fri Aug 18, 2006 4:39 am

I'm trying to add a DrawLineItem to a DrawLine tool associated with my chart using this code:

Code: Select all

Steema.TeeChart.Tools.DrawLineItem newLine = new Steema.TeeChart.Tools.DrawLineItem(drawLine1);
newLine.StartPos.X = 10;
newLine.StartPos.Y = 10;
newLine.EndPos.X = 50;
newLine.EndPos.Y = 50;
However, the line doesn't show up. I also tried calling Invalidate() on the chart and on drawLine1 and that doesn't work either. The tool has "Active" set to true. Any ideas?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Aug 18, 2006 7:40 am

Hi.

Perhaps the problem is the line lies ouside current axis scale? I've tried the following:

Code: Select all

Steema.TeeChart.Tools.DrawLineItem dli = new Steema.TeeChart.Tools.DrawLineItem(drawLine1);
dli.StartPos = new Steema.TeeChart.Drawing.PointDouble(10, 10);
dli.EndPos = new Steema.TeeChart.Drawing.PointDouble(50, 50);

tChart1.Axes.Bottom.SetMinMax(0, 50);
tChart1.Axes.Left.SetMinMax(0, 50);
and the line showed up as expected.
Marjan Slatinek,
http://www.steema.com

stratadat
Newbie
Newbie
Posts: 13
Joined: Mon Feb 13, 2006 12:00 am

Post by stratadat » Sat Aug 19, 2006 5:38 am

Yep, that was it. I was under the impression that the lines were relative to the X & Y of the chart itself but they're actually the X & Y of a particular axis.

Post Reply