sorting chart-data

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hartmut
Newbie
Newbie
Posts: 5
Joined: Fri May 06, 2005 4:00 am
Location: Germany

sorting chart-data

Post by Hartmut » Sun May 22, 2005 7:36 am

i'm using v. 7.05 std with d2005sp2. i tried to sort my data in chart (which i get from a sql-script and sent them to to series via: "Series1.AddBar(wert,IntToStr(vewert),clTeeColor);") but the following code didn't change anything:

case RadioGroup1.ItemIndex of
0: Series1.YValues.Order:=loNone;
1: Series1.YValues.Order:=loAscending;
2: Series1.YValues.Order:=loDescending;
end;
Chart1.Refresh;

so what's wrong?

hartmut

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

Post by Marjan » Mon May 23, 2005 9:44 am

Hi.

I think you forgot to add the "Sort" method call. Sorting example is available at our FAQ pages. Check the following link.
Marjan Slatinek,
http://www.steema.com

Hartmut
Newbie
Newbie
Posts: 5
Joined: Fri May 06, 2005 4:00 am
Location: Germany

Post by Hartmut » Mon May 23, 2005 12:53 pm

hi marjan,

thanks for your response - you were right with the sort-command.

but: if i show the data they are unsorted, then i can choose ascending or descending and it's shown ok, then i want to show them again unsorted (they are not really unsorted because they are sorted with the labels on x-axis) - how do i realize that?

regards,

hartmut

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

Post by Marjan » Mon May 23, 2005 3:06 pm

Hi.

The easiest solution I can think of is repopulate series with data from your original SQL statement. If you're using TDBChart, connected to query dataset, then all you must do is close and re-open the query (this will also automatically internally call Add method and repopulate series).

I think there is an example of this (sorting TDBChart series) available in TeeChart demo. Check the "All Features -> Database Charts -> Sort Order" example.
Marjan Slatinek,
http://www.steema.com

Post Reply