SeriesUp function takes no effect

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
leml
Newbie
Newbie
Posts: 3
Joined: Fri Jul 13, 2007 12:00 am

SeriesUp function takes no effect

Post by leml » Tue Mar 31, 2009 10:33 am

Hello,

I want change the series order, to bring MySeries to front after redraw.
Chart->SeriesUp(Myseries) takes no effect under RADStudio 2007.
Any solutions?

Regards
Andreas

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Mar 31, 2009 2:10 pm

Hi Andreas,

What TeeChart version are you using? Here with TeeChart v8.04 it seems to work fine.

You could also try using ExchangeSeries method as shown here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

leml
Newbie
Newbie
Posts: 3
Joined: Fri Jul 13, 2007 12:00 am

Post by leml » Wed Apr 01, 2009 7:51 am

hello Yeray,

your solution works, but unfortunately this function also changes the z-order of the series displayed in the legend. I need the original order in the legend and also Chart->Series[0] in the foreground.
Is there a way of making the SeriesUp-function work? I also use TeeChart 8.0.4 (in C++). Thanks in anticipation,

regards
Andreas

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed Apr 01, 2009 8:45 am

Hi Andreas,

I've tested the method SeriesUp with C++Builder 2007 and it seems to work fine here. Could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Anyway, note that the method SeriesUp changes the series order and the legend shows the items considering this order. So both using ExchangeSeries and SeriesUp method, your legend will be affected.

In order to sort your legend as you want, I recommend you to do it custom accessing to the individual items:

Code: Select all

Chart1->Legend->Item[0]
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

leml
Newbie
Newbie
Posts: 3
Joined: Fri Jul 13, 2007 12:00 am

Post by leml » Wed Apr 01, 2009 12:25 pm

Hello Yeray,

I've posted my files to your upload page.

Regards
Andreas

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed Apr 01, 2009 1:26 pm

Hi Andreas,

The SeriesUp method moves the desired series one position up in the series list. So having:
  • 0. series1
    1. series2
    2. series3
Doing SeriesUp(series1), it has no effect because series1 is already on top of the list.

The problem is that, having superposed series, the only visible will be the last one. So, to have series1 in the last position you have different possibilities. One possibility could be moving down series1 two times. Note that if you use seriesIndex instead of series pointers you should do:

Code: Select all

Chart1->SeriesDown(Chart1->Series[0]);
after this, note that you have:
  • 0. series2
    1. series1
    2. series3
So, to move down the series1 again, now you should:

Code: Select all

Chart1->SeriesDown(Chart1->Series[1]);
Then you'll have the following so that series 1 will be the visible one:
  • 0. series2
    1. series3
    2. series1
Another possibility could be creating your series with different pointers and then you'll be able to use always the same pointer to move the same line:

Code: Select all

TLineSeries *line1 = new TLineSeries(this);
TLineSeries *line2 = new TLineSeries(this);
TLineSeries *line3 = new TLineSeries(this);

//...

Chart1->SeriesDown(line1);
Chart1->SeriesDown(line1);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply