TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Mike Jones
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
-
Contact:
Post
by Mike Jones » Thu Apr 30, 2009 3:01 pm
That's because those are default values and need to be set again because in your *.ten file you previously changed them. Otherwise it would work fine. Do you have a special need for changing them?
I don't understand your response. In our real world application we produce the data to chart and add it to the chart in a very programmatic way. We don't set the XValues.Sort() method because we want to keep the chart UI as fast as possible. The demo I sent is simply a case of demonstrating what we see with disappearing points. We don't use the import of a ten file in our real application.
I think there is a logic problem with drawing the points. They are visible under certain conditions then some of the points disappear when the user pans and zooms. Can this issue be addressed?
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Apr 30, 2009 3:17 pm
Hi Mike,
No, it's not necesssary to sort the series if you set Order property before populating them, for example:
Code: Select all
points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
line1.FillSampleValues();
So our recommendation would be setting XValues.Order to Ascending before populating series if possible.
-
Mike Jones
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
-
Contact:
Post
by Mike Jones » Thu Apr 30, 2009 4:05 pm
We add our points by calling the Series.Add(double[], double[])
Will your suggestion work in this case?
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Apr 30, 2009 4:16 pm
Hi Mike,
You should test if it works fine in your environment to be 100% sure to confirm that but I'm afraid you'll need to sort the valuelist in that case, for example:
Code: Select all
double[] x = { 4, 2, 3, 1 };
double[] y = { 1, 2, 3, 4 };
points1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
points1.Add(x, y);
points1.XValues.Sort();
-
Mike Jones
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
-
Contact:
Post
by Mike Jones » Thu Apr 30, 2009 9:14 pm
In out application it looks like we take around a 3-5% hit in performance when calling the sort method. Ideally it would be nice if we could get away with not sorting, but it seems to take care of the bigger issue with points disappearing.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon May 04, 2009 9:24 am
Hi Mike,
I'm not sure if I made myself clear but the question here is whether it's necessary or not changing default series order. By default, XValues.Order in most series is set to ascending. The issue discussed here is because of the series in your template file (*.ten) are set to XValues.Order=None. If you already provided sorted data to your series it wouldn't be necessary changing this property in the ten file and therefore this issue wouln't exist. So our question is, is it necessary that you set XValues.Order to none? Is your data sorted when populating your series?
Thanks in advance.
-
Mike Jones
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
-
Contact:
Post
by Mike Jones » Mon May 04, 2009 2:35 pm
It is not a problem to do
Series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
Does that have any effect if we add our points using the Series.Add(double[], double[]) and we don't call the Series.Sort() method ?
I assumed the performance issues was caused by calling the Series.Sort() method.
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon May 04, 2009 2:41 pm
Hi Mike,
It is not a problem to do
Series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
Ok, in that case I strongly recommend you to set that *before* populating your series so there's no need to call Sort() later.
Does that have any effect if we add our points using the Series.Add(double[], double[]) and we don't call the Series.Sort() method ?
Yes, that's the clue! If your X values array is sorted you will not have to call Sort() to not have points disappearing.
I assumed the performance issues was caused by calling the Series.Sort() method.
That's rights. This method sorts series' values.
-
Mike Jones
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
-
Contact:
Post
by Mike Jones » Mon May 04, 2009 7:07 pm
As I stated before we can't always guarantee that the points we generate are sorted 100% of the time. If we only do
Series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
and not call the Series.Sort method, we have our original problem. Points will disappear when we pan or zoom. So it looks like we must call the Series.Sort method to ensure the points are 100% sorted. Hopefully the sort algorithm is efficient and when the points are mostly sorted it will be fast enough.