sorting multiple series on each label

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JohanI
Newbie
Newbie
Posts: 5
Joined: Fri Jun 29, 2007 12:00 am

sorting multiple series on each label

Post by JohanI » Mon Feb 25, 2008 7:56 am

Hi,

Consider the following case:

Say we have 3 barseries with 4 values in each serie, mulitbar is set to mbSide. This means that on each x-axis label there will be 3 bars, one bar representing one value for each serie. What I need to do is sort theese 3 bars(i.e 3 values from 3 different series) on each x-axis label in ascending order, so that for label A the user can directly see which serie that has the highest value and so on... Does anyone have any suggestions how to do this? As I read it the Sort function only sorts series "internally".

Best Regards,

Johan Ingemansson

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

Post by Pep » Tue Mar 04, 2008 11:22 am

Hi Johan,

I'm afraid there's not a way to do this automatically. The only way I can think of would be by sorting them before to add the data to the Chart. This means that in order to see each bar group with different color order you will need to add the data specifying the the specific color.

Code: Select all

With TChart1
    .AddSeries scBar
    .AddSeries scBar
    .AddSeries scBar
    
    ' check the order
    
    .Series(0).Add 10, "A", vbRed
    .Series(1).Add 20, "A", vbBlue
    .Series(2).Add 30, "A", vbGreen
       
    .Series(0).Add 50, "B", vbBlue
    .Series(1).Add 70, "B", vbRed
    .Series(2).Add 100, "B", vbGreen
End With

Post Reply