How Do I Create a Line from Points?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

How Do I Create a Line from Points?

Post by Dave » Tue Jul 10, 2012 2:55 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How Do I Create a Line from Points?

Post by Sandra » Wed Jul 11, 2012 3:01 pm

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,
Best Regards,
Sandra Pazos / 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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: How Do I Create a Line from Points?

Post by Dave » Thu Jul 12, 2012 2:54 pm

Thanks Sandra, that works.

Post Reply