sorting summary series by group value

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jls
Newbie
Newbie
Posts: 30
Joined: Mon Jul 23, 2007 12:00 am

sorting summary series by group value

Post by jls » Wed Nov 12, 2008 1:17 pm

I try to sort a summary series by the group value.

This work if the group values are text, but if the group value is numeric or dates it is wrong.

In this cases the labels are sorted by the numeric text/ date as text not the value.

eg numeric is sorted like this:
0.1.11.2.2222,9
should be
0,1,2,9,11,2222

How can I solve this?

Jørgen

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

Post by Pep » Mon Nov 17, 2008 12:49 pm

Hi Jørgen,

changing the axis label style to talValue should solve it :
Chart1.Axes.Left.LabelsStyle := talValue;

jls
Newbie
Newbie
Posts: 30
Joined: Mon Jul 23, 2007 12:00 am

Post by jls » Mon Nov 17, 2008 1:50 pm

This doesn't work for datetime values.
The are displayed as 0,1,2,3,4....



Jørgen

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

Post by Pep » Mon Nov 17, 2008 4:15 pm

Hi Jørgen,

have you set the values to datetime ?
TChart1.Series(0).YValues.DateTime = True

jls
Newbie
Newbie
Posts: 30
Joined: Mon Jul 23, 2007 12:00 am

Post by jls » Tue Nov 18, 2008 2:57 pm

I tried to set .DateTime = True
but this doesn't help



The problem is with grouped DBCharts

The values are grouped by a datetime field.


I have now changed my code to sort the dataset. This works, but it should have worked with teechart sorting to.,

Is it possible to sort a grouped chart where the grouped value is DateTime/ numbers ?


Jørgen

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

Post by Pep » Mon Nov 24, 2008 6:29 pm

Hi J

it should work just using :

Code: Select all

  dbchart1.Axes.Bottom.LabelStyle := talValue;
  series1.xvalues.DateTime := true;
  Series1.XValues.Order:= loAscending;

  ComboBox1.ItemIndex:=2;
  ComboBox2.ItemIndex:=0;
I've tried it here with the demo "dbChart_Summary.pas" included into the TeeNew8 demo project, just adding the above lines into the formShow and openning the table it sorts the datapoints by date.

Post Reply