Page 1 of 1

Easy way to Move Series in front of Another

Posted: Sun Sep 04, 2016 4:47 am
by 13049545
Hi Steema --

Without recoding my javascript too much -

Is there an easy way to move one series in front of another as it's being blocked.

I know I can recode and the series in a different order but I do a lot of index based updates and such and would rather not have to change that.

is there a Z-Order property or MoveSeriesUp or something like that?

Thanks so much,

Joseph

Re: Easy way to Move Series in front of Another

Posted: Mon Sep 05, 2016 8:26 am
by yeray
Hello,

The series are in an array you can swap elements from as with any array. Ie:

Code: Select all

            var tmp = Chart1.series.items[0];
            Chart1.series.items[0] = Chart1.series.items[1];
            Chart1.series.items[1] = tmp;
If you want to do it with a function:

Code: Select all

        Array.prototype.swap = function(a, b) {
            var temp = this[a];
            this[a] = this[b];
            this[b] = temp;
        };
And then:

Code: Select all

            Chart1.series.items.swap(0,1);

Re: Easy way to Move Series in front of Another

Posted: Mon Sep 05, 2016 8:59 pm
by 13049545
Hi Yeray --

I think this is the same as just adding the series to the chart in a different order.

All my code that is array based will still have to be modified.

I was hoping for an answer that wouldn't require change all my array based index code.

Such as Series1.ZOrder = 0 or something like that.

I do appreciate your help however.

I'll just rewrite my code it's not a huuuuge deal. :)

Thanks again.

Joseph