@@ -17,22 +17,14 @@ export const AxisAnchorDropdown = connectToContainer(UnconnectedDropdown, {
1717 const { localize : _ } = context ;
1818 let options = [ ] ;
1919
20- if (
21- plotProps . fullContainer &&
22- plotProps . fullContainer . _subplot &&
23- plotProps . fullContainer . _subplot . includes ( 'xaxis' )
24- ) {
20+ if ( props . attr . startsWith ( 'xaxis' ) ) {
2521 options = context . fullLayout . _subplots . yaxis . map ( axis => {
2622 return {
2723 label : getAxisTitle ( context . fullLayout [ axisIdToAxisName ( axis ) ] ) ,
2824 value : axis ,
2925 } ;
3026 } ) ;
31- } else if (
32- plotProps . fullContainer &&
33- plotProps . fullContainer . _subplot &&
34- plotProps . fullContainer . _subplot . includes ( 'yaxis' )
35- ) {
27+ } else if ( props . attr . startsWith ( 'yaxis' ) ) {
3628 options = context . fullLayout . _subplots . xaxis . map ( axis => {
3729 return {
3830 label : getAxisTitle ( context . fullLayout [ axisIdToAxisName ( axis ) ] ) ,
@@ -49,22 +41,15 @@ export const AxisOverlayDropdown = connectToContainer(UnconnectedDropdown, {
4941 modifyPlotProps : ( props , context , plotProps ) => {
5042 const { localize : _ } = context ;
5143 let options = [ ] ;
52- if (
53- plotProps . fullContainer &&
54- plotProps . fullContainer . _subplot &&
55- plotProps . fullContainer . _subplot . includes ( 'xaxis' )
56- ) {
44+
45+ if ( props . attr . startsWith ( 'xaxis' ) ) {
5746 options = context . fullLayout . _subplots . xaxis . map ( axis => {
5847 return {
5948 label : getAxisTitle ( context . fullLayout [ axisIdToAxisName ( axis ) ] ) ,
6049 value : axis ,
6150 } ;
6251 } ) ;
63- } else if (
64- plotProps . fullContainer &&
65- plotProps . fullContainer . _subplot &&
66- plotProps . fullContainer . _subplot . includes ( 'yaxis' )
67- ) {
52+ } else if ( props . attr . startsWith ( 'yaxis' ) ) {
6853 options = context . fullLayout . _subplots . yaxis . map ( axis => {
6954 return {
7055 label : getAxisTitle ( context . fullLayout [ axisIdToAxisName ( axis ) ] ) ,
@@ -78,7 +63,11 @@ export const AxisOverlayDropdown = connectToContainer(UnconnectedDropdown, {
7863 // filter out the current axisID, can't overlay over itself
7964 plotProps . options = options . filter (
8065 option =>
81- context . fullContainer && context . fullContainer . _id !== option . value
66+ context . fullContainer &&
67+ context . fullContainer . xaxis &&
68+ context . fullContainer . yaxis &&
69+ context . fullContainer . xaxis . _id !== option . value &&
70+ context . fullContainer . yaxis . _id !== option . value
8271 ) ;
8372
8473 plotProps . clearable = false ;
@@ -99,23 +88,16 @@ export const RangesliderVisible = connectToContainer(UnconnectedRadio, {
9988export const AxisSide = connectToContainer ( UnconnectedRadio , {
10089 modifyPlotProps : ( props , context , plotProps ) => {
10190 const _ = context . localize ;
102- if (
103- context . fullContainer &&
104- context . fullContainer . _id &&
105- context . fullContainer . _id . startsWith ( 'y' )
106- ) {
91+
92+ if ( props . attr . startsWith ( 'yaxis' ) ) {
10793 plotProps . options = [
10894 { label : _ ( 'Left' ) , value : 'left' } ,
10995 { label : _ ( 'Right' ) , value : 'right' } ,
11096 ] ;
11197 return ;
11298 }
11399
114- if (
115- context . fullContainer &&
116- context . fullContainer . _id &&
117- context . fullContainer . _id . startsWith ( 'x' )
118- ) {
100+ if ( props . attr . startsWith ( 'xaxis' ) ) {
119101 plotProps . options = [
120102 { label : _ ( 'Bottom' ) , value : 'bottom' } ,
121103 { label : _ ( 'Top' ) , value : 'top' } ,
0 commit comments