Page 1 of 1

Order doesn't work?

Posted: Fri Jul 02, 2004 11:19 pm
by 4213725
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

Posted: Mon Jul 05, 2004 8:34 am
by Marjan
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));

Posted: Tue Jul 06, 2004 2:23 pm
by 4213725
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

Posted: Tue Jul 06, 2004 6:14 pm
by Pep
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 ?

Posted: Wed Jul 07, 2004 5:59 pm
by 4213725
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