Getting default pane / first created pane out of multiple panes #1838
-
|
Hello initially this is the default pane , chart.panes()[0] but after doing swapPanes and moveTo panes with multiple panes.. is there a way to find out which is the original default pane... is there a default way to do it ? Because its tedious process to keep reference after swapPanes and moveTo .... or can we assign a id to it so we can later do chart.getPane(id) something like this ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
You are given an instance of const first = chart.panes()[0];
chart.swapPanes(0, 1);
console.log(first.paneIndex()); // -> 1
console.log(chart.panes().indexOf(first)); // -> 1
chart.swapPanes(0, 1);
console.log(chart.panes().indexOf(first)); // -> 0
console.log(first.paneIndex()); // -> 0 |
Beta Was this translation helpful? Give feedback.
You are given an instance of
IPaneApiwhen usingchart.panes()[0]. You can consider this the 'default' pane and keep a reference to it. You can use thepaneIndex()method to get it's current index on the chart.