Page 1 of 1
sorting chart-data
Posted: Sun May 22, 2005 7:36 am
by 9038823
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
Posted: Mon May 23, 2005 9:44 am
by Marjan
Hi.
I think you forgot to add the "Sort" method call. Sorting example is available at our FAQ pages. Check the following
link.
Posted: Mon May 23, 2005 12:53 pm
by 9038823
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
Posted: Mon May 23, 2005 3:06 pm
by Marjan
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.