Sort order of bar graphs using DBCrossTabSource
Sort order of bar graphs using DBCrossTabSource
I am trying to maintain some code that I inherited, so I do not entirely understand what I am reading. In addition, I have been unable to find any documentation about DBCrossTabSource either online or in the Help that came with the product. Perhaps someone can point me at the documentation.
When I use DBCrossTabSource, I see a number of bar graphs, each with a title/label. Unfortunately, if labels exist for "A", "B", and "C", they often appear as "B", "C", and then "A". That is, they are not correctly sorted.
Is there any way to have the graphs appear in alphabetical order, instead of randomly?
I am using 7.12 for Delphi 2007
Thanks!
Jon
When I use DBCrossTabSource, I see a number of bar graphs, each with a title/label. Unfortunately, if labels exist for "A", "B", and "C", they often appear as "B", "C", and then "A". That is, they are not correctly sorted.
Is there any way to have the graphs appear in alphabetical order, instead of randomly?
I am using 7.12 for Delphi 2007
Thanks!
Jon
Re: Sort order of bar graphs using DBCrossTabSource
Hi,
Try with SortByLabels function. Ie, for the first series in a chart:
Try with SortByLabels function. Ie, for the first series in a chart:
Code: Select all
Chart1[0].SortByLabels();
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Sort order of bar graphs using DBCrossTabSource
Thanks for your help! I tried this, but I'm using a DBChart, and the code that you suggested does not compile. That is "DBChart1.SortByLabels" does not work.
Re: Sort order of bar graphs using DBCrossTabSource
Hi,
DBChart1.SortByLabels not! DBChart1[0].SortByLabels. DBChart1[0] is the first series in the DBChart1 chart.
DBChart1.SortByLabels not! DBChart1[0].SortByLabels. DBChart1[0] is the first series in the DBChart1 chart.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Sort order of bar graphs using DBCrossTabSource
Thank you, again! That does compile, but the charts still appear in an un-sorted order, as can be seen in the attached screen shot. I would like the Quarters to ascend uniformly
- Attachments
-
- dbChart.PNG (23.64 KiB) Viewed 7376 times
Re: Sort order of bar graphs using DBCrossTabSource
Hi,
I'm not sure if this is how you are creating your charts:
With the above, I get this:
Then, if I uncomment the SortByLabels(loDescending) line in the code above, this is what I get:
Isn't it how it behaves for you?
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
I'm not sure if this is how you are creating your charts:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
with Chart1.AddSeries(THorizBarSeries) as THorizBarSeries do
begin
Marks.Visible:=false;
Add(1, 'Post-analytic');
Add(14, 'Analytic');
Add(18, 'No error, or not yet classified');
Add(207, 'Pre-analytic');
//SortByLabels(loDescending);
end;
end;
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Sort order of bar graphs using DBCrossTabSource
Thank you, again, for your help.
I am not trying to change the order of the bars within the charts. I am trying to change the order of the charts on the page.
The current order is
Quarter: 2005.1
Quarter: 2004.4
Quarter: 2003.1
Quarter: 2004.3
This order makes it difficult to find a particular chart, because the order appears to be random.
I imagine that the charts are in this order because they are sorted by Total Count, but I want the option of sorting them by their labels (Quarter: 2005.1)
I am not trying to change the order of the bars within the charts. I am trying to change the order of the charts on the page.
The current order is
Quarter: 2005.1
Quarter: 2004.4
Quarter: 2003.1
Quarter: 2004.3
This order makes it difficult to find a particular chart, because the order appears to be random.
I imagine that the charts are in this order because they are sorted by Total Count, but I want the option of sorting them by their labels (Quarter: 2005.1)
Re: Sort order of bar graphs using DBCrossTabSource
Hi,
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Sort order of bar graphs using DBCrossTabSource
I did as you asked, and am now thinking that the problem is in some other code. Thank you for your time and help, but I doubt that the problem is in TeeChart.