Order property of TBarSeries.YValues does not work

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Order property of TBarSeries.YValues does not work

Post by Joschi » Mon Jan 05, 2004 11:58 am

Dear support team.

It seems that the Order property of TBarSeries.YValues does not work correctly. In the FAQ, you write:

--------------------------------------------------------------------------------
Q: How do I sort Series in an ascending/descending order?
If you already added points to series and just want to sort them in descending order, add

DELPHI CODE :

Series1.Yvalues.Order:=loDescending;
--------------------------------------------------------------------------------
But this line of code has absolutely no effect on the chart. You can easilyverify this by creating a small sample program with one chart and onehorizontal bar series and a button with the following OnClick event:

Series.FillSampleValues(24);
Series.YValues.Order := loDescending;

Best regards,

Joachim Marder
JAM Software

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

Post by Marjan » Mon Jan 05, 2004 1:40 pm

Hi, Joachim.

True, code used in FAQ pages will not work. It's a "bug" in documentation. But the following code will work fine:

Code: Select all

  Series1.XValues.Order := loNone;
  Series1.YValues.Order := loAscending;
  Series1.YValues.Sort;
  Series1.XValues.FillSequence;
  Series1.Repaint;
BTW, which FAQ page (link) are you refering to? I tried to find and fix it (new faq pages) but I could not find it :oops:
Marjan Slatinek,
http://www.steema.com

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Mon Jan 05, 2004 2:17 pm

Dear Marjan.

First of all, thanks for the speedy reply. Unfortunately the code sample does not do what it promises, because it seems that FillSequence changes the YValues to 1,2,3,... You can easily test this by copy&pasting the code to a simple test program with a horizontal bar series.

The link to the FAQ is:
http://www.steema.com/support/faq/NewVC ... BAR.htm#Q4

Unfortunately your code sample is no replacement for the code sample in the FAQ. Any help on how to sort a bar chart dynamically is appreciated.

And there's one more documentation bug: The TChartValueList.Sort method is missing in the help file.

Best regards,

Joachim Marder

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

Post by Marjan » Mon Jan 05, 2004 2:46 pm

Hi, Joachim.
Aha, the "old" FAQ pages. These pages have been updated for the latest TeeChart version. New FAQ pages can be accessed at:
http://www.teechart.net/support/modules ... %20/%20CLX
promises, because it seems that FillSequence changes the YValues to 1,2,3,... You can easily test this by copy&pasting the code to a simple test program with a horizontal bar series.
The code is for normal vertical series type. For horizontal series type, you should swap x and y values i.e. use the following

Code: Select all

  Series1.YValues.Order := loNone; 
  Series1.XValues.Order := loAscending; 
  Series1.XValues.Sort; 
  Series1.YValues.FillSequence; 
  Series1.Repaint; 
And there's one more documentation bug: The TChartValueList.Sort method is missing in the help file.
I think this is documented in TeeChart v6 help files.
Marjan Slatinek,
http://www.steema.com

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Mon Jan 05, 2004 3:10 pm

Dear Marjan.

Yes, swapping X and YValues did the trick. Thank you very much for your assistance. The only problem that is left for me is that I have a stacked series and now must sort the second series according to the first one. Can this be done with TeeChart?
Aha, the "old" FAQ pages. These pages have been updated for the latest TeeChart version
BTW, it seems that this question is missing in the new FAQ.
I think this is documented in TeeChart v6 help files.
Neither in the help file, nor on http://www.berneda.com/TeeChart6Docs/TC ... thods.html I was able to find the Sort method documentes.

Thanks and best regards,

Joachim Marder
JAM Software

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

Post by Marjan » Tue Jan 06, 2004 7:44 am

Hi, Joachim.

Re "missing FAQ entry" : fixed, just added it.

Re "missing Sort method" : hmm... Ok, noted. There is a reference to Sort method in FillSequence method help entry. But Sort is not documented. We'll try to improve this for TeeChart v7.0 release.
Marjan Slatinek,
http://www.steema.com

Post Reply