Page 1 of 1

How Do I Create a Line from Points?

Posted: Tue Jul 10, 2012 2:55 pm
by 13050364
Hi

This must sound like such a simple question but I can't get it to work. I'm creating a line thus;

theLine = new Line();
theLine.Add(new Point(0, 0));
theLine.Add(new Point(1, 1));
theLine.Add(new Point(2, 2));
myChart.Series.Add(theLine);

Anyone know why my chart isn't displaying a line. Nothing is displayed.

Note I can display the line by doing this;

int[] X = {1,2,3};
int[] Y = {1,2,3};
Line line1 = new Line();
line1.Add(X,Y);
myChart.Series.Add(line1);

But I dont want to build up my line like this because I wont be able to predefine the values in an array.
Im getting the values from some hardware so I just want to keep adding points


We are using TeeChart version 3.5.3187.15585 and C#.NET

Re: How Do I Create a Line from Points?

Posted: Wed Jul 11, 2012 3:01 pm
by 10050769
Hello Dave,

To create a Line with using points you need use PointF, if you want it works as you expect. See next lines of code:

Code: Select all

      line1.Add(new PointF(0, 0));
            line1.Add(new PointF(1, 1));
            line1.Add(new PointF(2, 2));
On the other hand, I recommend you taking a look in the Help References, concretly in Series->Add method where you will find, what structures of data you can use in this method.

Thanks,

Re: How Do I Create a Line from Points?

Posted: Thu Jul 12, 2012 2:54 pm
by 13050364
Thanks Sandra, that works.