Page 1 of 1

SeriesUp function takes no effect

Posted: Tue Mar 31, 2009 10:33 am
by 10046095
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

Posted: Tue Mar 31, 2009 2:10 pm
by yeray
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.

Posted: Wed Apr 01, 2009 7:51 am
by 10046095
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

Posted: Wed Apr 01, 2009 8:45 am
by yeray
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]

Posted: Wed Apr 01, 2009 12:25 pm
by 10046095
Hello Yeray,

I've posted my files to your upload page.

Regards
Andreas

Posted: Wed Apr 01, 2009 1:26 pm
by yeray
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);