ChangeType doesn´t preserve order of X values?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dimitrig
Newbie
Newbie
Posts: 18
Joined: Thu Aug 17, 2006 12:00 am
Location: Belgium
Contact:

ChangeType doesn´t preserve order of X values?

Post by dimitrig » Thu Sep 21, 2006 4:01 pm

Hi,

When I use the Series.ChangeType method on a series, that already has specific ordering set for the X values, this ordering is not preserved while changing to another type.

Code: Select all

Series mySeries = tChart.Series.Add(typeof(FastLine));
mySeries.XValues.Order = ValueListOrder.None;
// Append a couple of points            
Random rnd = new Random();
for (int pointIndex = 0; pointIndex < 10; pointIndex++)
{
    mySeries.Add(rnd.NextDouble(),rnd.NextDouble());
}

--> this would result in a plot showing random lines

// Change the plot type
Series.ChangeType(ref mySeries, typeof(Line));

--> this results in lines that are ordered according to X-axis value (default ascending ordered)
I´m using the stable v2.0.2306.26232 version of the library. Didn´t find a bugfix that fixes it in the latest Debug build (in the release notes).

Regards

[/code]

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 22, 2006 7:48 am

Hi dimitrig,

This is because line series is designed to plot sequential data. Please read this thread where this is explained.
Best Regards,
Narcís Calvet / 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

dimitrig
Newbie
Newbie
Posts: 18
Joined: Thu Aug 17, 2006 12:00 am
Location: Belgium
Contact:

Post by dimitrig » Fri Sep 22, 2006 8:22 am

Thanks for the reply.

I understand that a line series defaults to sequential data, nevertheless it is perfectly possible to plot non-sequential data on it (when setting the order properly to None), as can be seen in this image:
Image

So I would expect that when you use the ChangeType method, before the values are copied to the new series, the ordering is preserved instead of gone back to the default for the new plot type.
So in the ChangeType method I would expect that there are 2 lines somewhere that state:

Code: Select all

newSeries.XValues.Order = oldSeries.XValues.Order;
newSeries.YValues.Order = oldSeries.YValues.Order;
Is it really the purpose that this does not happen?
If it is, is there a known workaround to easily change the plot type, but preserve the order?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 22, 2006 11:36 am

Hi dimitrig,

Yes, you are right, this is a bug (TF02011763) which I've added to our defect list to be fixed for future releases. The only solution I've found is creating a new series, manually copying all original series to the new series and finally removing the old series:

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
      Line line1 = new Line(tChart1.Chart);

      line1.XValues.Order = tChart1[0].XValues.Order;
      line1.Color = tChart1[0].Color;

      for (int i = 0; i < tChart1[0].Count; i++)
      {        
        line1.Add(tChart1[0].XValues[i], tChart1[0].YValues[i]);
      }

      tChart1.Series.Remove(tChart1[0]);      
    }
Best Regards,
Narcís Calvet / 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

dimitrig
Newbie
Newbie
Posts: 18
Joined: Thu Aug 17, 2006 12:00 am
Location: Belgium
Contact:

Post by dimitrig » Fri Mar 09, 2007 2:12 pm

Hi,

I'm using the latest version of the library (2.0.2586.24039), and this bug is still present (half year has passed since then). To me, it looks that this can be easily fixed, so I would've expected to see it fixed earlier. Any idea when this will be fixed and/or is it possible to speed up this fix, since it's important for us that this is solved?

Regards

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 09, 2007 3:32 pm

Hi dimitrig,

I can't tell you for sure when this will be fixed. I've increased its priority in the list to be fixed sooner. Please be aware at this forum for new release announcements and what's implemented on them.
Best Regards,
Narcís Calvet / 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

Post Reply