Hi,
We have been using TeeChart.NET for more than a decade and love it. We have always loaded data into the FastLine using code such as:
For count = 1 To samplecount
FastLineVelocity.Add(velocity(count), force(count))
Next count
However, we have been having trouble with a new plot and so have change to loading x and y data arrays and then passing the array to FastLine.Add e.g.
For count = 1 To samplecount - 1
xdata(count) = velocity(count)
ydata(count) = force(count)
Next count
FastLineForce.Add(xdata, ydata)
This is working so my question is should we continue with this method and is there some explanation as to why the first method results in FastLine that the data has the x and y coordinates out of order every 10 or so data points?
Thanks for any insight.
Best regards
Rob
Fastline.Add - load with individual points or pass array
-
- Newbie
- Posts: 13
- Joined: Wed Dec 19, 2018 12:00 am
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hello Rob,
That's fantastic, we really are so pleased to hear that, thank you!wrote: ↑Fri Feb 15, 2019 12:01 amWe have been using TeeChart.NET for more than a decade and love it.
Clearly this shouldn't happen, and we will get to the bottom of the question soon. To help us do so, would you be so kind as to export the data you're having trouble with to a *.csv or *.xml file so we can reproduce your issue here?wrote: ↑Fri Feb 15, 2019 12:01 amThis is working so my question is should we continue with this method and is there some explanation as to why the first method results in FastLine that the data has the x and y coordinates out of order every 10 or so data points?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 13
- Joined: Wed Dec 19, 2018 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hi Christopher,
Thanks for your reply. I cannot figure out why there is a difference. With follow code:
For count = 0 To plotsamples
FastLineForce.Add(velocity(count + zoomstart), force(count + zoomstart))
Next count
I get the distorted graph attached. Some points are plotting correctly but then there is a sequence out and the back to correct etc.
However, if I use the following code with the exact same data arrays:
For count = 0 To plotsamples
xdata(count) = velocity(count + zoomstart)
ydata(count) = force(count + zoomstart)
Next count
FastLineForce.Add(xdata, ydata)
The graph is displayed correctly (image attached). I have attached the data as CSV but the Forum would not allow upload with .CSV extension so I have renamed FastLine Data.zip to get around the filetype filter.
Please let me know if you need anything else. I will be interested in your thoughts.
Best regards
Rob
Thanks for your reply. I cannot figure out why there is a difference. With follow code:
For count = 0 To plotsamples
FastLineForce.Add(velocity(count + zoomstart), force(count + zoomstart))
Next count
I get the distorted graph attached. Some points are plotting correctly but then there is a sequence out and the back to correct etc.
However, if I use the following code with the exact same data arrays:
For count = 0 To plotsamples
xdata(count) = velocity(count + zoomstart)
ydata(count) = force(count + zoomstart)
Next count
FastLineForce.Add(xdata, ydata)
The graph is displayed correctly (image attached). I have attached the data as CSV but the Forum would not allow upload with .CSV extension so I have renamed FastLine Data.zip to get around the filetype filter.
Please let me know if you need anything else. I will be interested in your thoughts.
Best regards
Rob
- Attachments
-
- FastLine Data.zip
- (9.42 KiB) Downloaded 1128 times
-
- FastLine Plot Correct.jpg (68.97 KiB) Viewed 21582 times
-
- FastLine Plot Distorted.jpg (122.2 KiB) Viewed 21582 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hello Rob,
I'm having problems trying to open the zip file here - both 7-Zip and Window's built-in zip extractor give me errors:
could you please generate a new zip file for me and post it here again?
I'm having problems trying to open the zip file here - both 7-Zip and Window's built-in zip extractor give me errors:
could you please generate a new zip file for me and post it here again?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 13
- Joined: Wed Dec 19, 2018 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hi Christopher,
The file is CSV so no need to unzip. Just rename changing .zip to .csv
I had to do this because the forum will not accept files with .csv extension.
Kind regards
Rob
The file is CSV so no need to unzip. Just rename changing .zip to .csv
I had to do this because the forum will not accept files with .csv extension.
Kind regards
Rob
-
- Newbie
- Posts: 13
- Joined: Wed Dec 19, 2018 12:00 am
Re: Fastline.Add - load with individual points or pass array
Here is the file Zip compressed as well.
- Attachments
-
- FastLine Data.zip
- (3.53 KiB) Downloaded 1114 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hello Rob,
that'll teach me to read things more carefully! Thanks for your patience in sending me what I had mistakenly expected.
The answer is the ordering of the XValues - by default they are ordered, so when you add your values in one-by-one they are ordered. Adding in the values directly to the arrays bypasses this. The solution is to set the XValues ordering to None, e.g.
that'll teach me to read things more carefully! Thanks for your patience in sending me what I had mistakenly expected.
The answer is the ordering of the XValues - by default they are ordered, so when you add your values in one-by-one they are ordered. Adding in the values directly to the arrays bypasses this. The solution is to set the XValues ordering to None, e.g.
Code: Select all
public struct MyStruct
{
public double Time { get; set; }
public double Velocity { get; set; }
public double Force { get; set; }
}
private void InitializeChart()
{
FastLine forvel = new FastLine(tChart1.Chart);
var lines = File.ReadAllLines(@"C:\tmp\FastLine Data.csv").Skip(1)
.Select(x => x.Split(','))
.Select(x => x.Select(y => double.Parse(y)))
.Select(x => new MyStruct() { Time = x.ToArray()[0], Velocity = x.ToArray()[1], Force = x.ToArray()[2] }).ToArray();
forvel.XValues.Order = ValueListOrder.None;
for (int count = 0; count < lines.Length; count++)
{
forvel.Add(lines[count].Velocity, lines[count].Force);
}
//forvel.Add(lines.Select(x => x.Velocity).ToArray(), lines.Select(y => y.Force).ToArray());
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 13
- Joined: Wed Dec 19, 2018 12:00 am
Re: Fastline.Add - load with individual points or pass array
Hi Christopher,
Brilliant!
All looking good now. Thanks very much. As always outstanding support from Steema!
Kind regards
Rob
Brilliant!
All looking good now. Thanks very much. As always outstanding support from Steema!
Kind regards
Rob