Page 1 of 1

Add DrawLineItem from code

Posted: Fri Aug 18, 2006 4:39 am
by 9640311
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?

Posted: Fri Aug 18, 2006 7:40 am
by Marjan
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.

Posted: Sat Aug 19, 2006 5:38 am
by 9640311
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.