Order doesn't work?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
DClark
Newbie
Newbie
Posts: 9
Joined: Fri Nov 15, 2002 12:00 am
Location: New Mexico USA

Order doesn't work?

Post by DClark » Fri Jul 02, 2004 11:19 pm

Is there a condition that prevents XValues->Order from working? My values are always sorted lowest.. highest, even though I've set Order to loNone.

-Dean

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Jul 05, 2004 8:34 am

Hi, Dean.

If you set the Order property to loNone *before* you start adding points then it should work fine. Example:

Code: Select all

// draw an ellipse (parametric plot)
Series1.Clear;
Series1.XValues.Order := loNone;
for t :=0 to 20 do
  Series1.AddXY(2*Cos(Pi*i/10),3*Sin(Pi*i/10));
Marjan Slatinek,
http://www.steema.com

DClark
Newbie
Newbie
Posts: 9
Joined: Fri Nov 15, 2002 12:00 am
Location: New Mexico USA

Post by DClark » Tue Jul 06, 2004 2:23 pm

The problem seems to be if the abscissa values cross 0. If some of the values are negative and some positive, they are always sorted. If all the values are negative, or all are positive, Order = loNone seems to work.

BTW, I'm using TeeChart Pro 5 for C++Builder 6.

-Dean

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Jul 06, 2004 6:14 pm

Hi Dean,

I've just test it here with the TeeChart Pro v5.03 and BCB5 and the following works fine :

Code: Select all

void __fastcall TForm1::FormCreate(TObject *Sender)
{
Series1->XValues->Order = loNone;
Series1->AddXY(-3,10,"",clTeecolor);
Series1->AddXY(3,5,"",clTeecolor);
Series1->AddXY(-2,1,"",clTeecolor);
Series1->AddXY(2,13,"",clTeecolor);
}
I've attached the example and image I get in the public.steema.attachments newsgroup. Could you plese check is it works fine for you ?

DClark
Newbie
Newbie
Posts: 9
Joined: Fri Nov 15, 2002 12:00 am
Location: New Mexico USA

Post by DClark » Wed Jul 07, 2004 5:59 pm

The positive/negative thing wasn't an issue -- I spoke prematurely.

I guess this will just remain a mystery. I have :

* Set the XValues->Order property immediately after creating the series (a TLineSeries allocated and assigned to a TCustomSeries pointer at runtime, in the form constructor) and, for good measure, immediately after clearing the series before plotting new data.

* I've checked the data as I add it to the series.

* I've checked the contents of the XValue array right after my AddXY loop and in the OnGetAxisLabel handler.

* The XValues->FOrder property is 0 at every point in the code I check.

* The OnGetAxisLabel handler properly rescales the labels without changing the sign, and I did try taking it out altogether.

Everything looks just fine, except that the data insists on being plotted in ascending order, which is <B>exactly the opposite</B> of the order the data is inserted.

I have another plot class in which setting loNone seems to work, so I know TeeChart isn't just broken. I've compared this plot class to the other one and the chart code itself isn't much different. Hence the original question, whether there's some other setting in TeeChart that would make it change the data order, even if Order == loNone?

Thanks for looking into this.
-Dean

Post Reply