Skip to content

Commit 1d8130e

Browse files
committed
Make .subplot && .axisGroup private keys
1 parent a12f2ef commit 1d8130e

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/components/fields/AxesSelector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class AxesSelector extends Component {
2323
axesOptions &&
2424
axesOptions.some(option => {
2525
return (
26-
option.axisGroup &&
27-
this.context.fullLayout._subplots[option.axisGroup].length > 1
26+
option._axisGroup &&
27+
this.context.fullLayout._subplots[option._axisGroup].length > 1
2828
);
2929
});
3030

src/components/fields/derived.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ export const AxisAnchorDropdown = connectToContainer(UnconnectedDropdown, {
1717
const {localize: _} = props;
1818
let options = [];
1919
plotProps.options = [{label: 'x', value: 'x'}];
20-
if (plotProps.fullContainer.subplot.includes('xaxis')) {
20+
if (plotProps.fullContainer._subplot.includes('xaxis')) {
2121
options = context.fullLayout._subplots.yaxis.map(axis => {
2222
return {
2323
label: getAxisTitle(context.fullLayout[axisIdToAxisName(axis)]),
2424
value: axis,
2525
};
2626
});
27-
} else if (plotProps.fullContainer.subplot.includes('yaxis')) {
27+
} else if (plotProps.fullContainer._subplot.includes('yaxis')) {
2828
options = context.fullLayout._subplots.xaxis.map(axis => {
2929
return {
3030
label: getAxisTitle(context.fullLayout[axisIdToAxisName(axis)]),
@@ -41,14 +41,14 @@ export const AxisAnchorDropdown = connectToContainer(UnconnectedDropdown, {
4141
export const AxisOverlayDropdown = connectToContainer(UnconnectedDropdown, {
4242
modifyPlotProps: (props, context, plotProps) => {
4343
let options = [];
44-
if (plotProps.fullContainer.subplot.includes('xaxis')) {
44+
if (plotProps.fullContainer._subplot.includes('xaxis')) {
4545
options = context.fullLayout._subplots.xaxis.map(axis => {
4646
return {
4747
label: getAxisTitle(context.fullLayout[axisIdToAxisName(axis)]),
4848
value: axis,
4949
};
5050
});
51-
} else if (plotProps.fullContainer.subplot.includes('yaxis')) {
51+
} else if (plotProps.fullContainer._subplot.includes('yaxis')) {
5252
options = context.fullLayout._subplots.yaxis.map(axis => {
5353
return {
5454
label: getAxisTitle(context.fullLayout[axisIdToAxisName(axis)]),

src/lib/connectAxesToLayout.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ function computeAxesOptions(axes, _) {
1515
for (let i = 0; i < axes.length; i++) {
1616
const ax = axes[i];
1717
const label = capitalize(ax._name.split('axis')[0]);
18-
const value = (ax.subplot &&
19-
!ax.subplot.includes('xaxis') &&
20-
!ax.subplot.includes('yaxis')
21-
? ax.subplot + '.' + ax._name
22-
: ax.subplot
18+
const value = (ax._subplot &&
19+
!ax._subplot.includes('xaxis') &&
20+
!ax._subplot.includes('yaxis')
21+
? ax._subplot + '.' + ax._name
22+
: ax._subplot
2323
).trim();
2424

2525
options[i + 1] = {
2626
label,
2727
value,
28-
axisGroup: ax.axisGroup,
28+
axisGroup: ax._axisGroup,
2929
title: getAxisTitle(ax),
3030
};
3131
}
@@ -105,7 +105,7 @@ export default function connectAxesToLayout(WrappedComponent) {
105105
const keys = Object.keys(update);
106106
for (let i = 0; i < keys.length; i++) {
107107
for (let j = 0; j < axes.length; j++) {
108-
const subplot = axes[j].subplot;
108+
const subplot = axes[j]._subplot;
109109
let axesKey = axes[j]._name;
110110

111111
if (

src/lib/getAllAxes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ export default function getAllAxes(fullLayout) {
1919
? subplot.slice(0, 1) + 'axis' + subplot.slice(1)
2020
: subplot + 'axis';
2121

22-
fullLayout[subplot].subplot = subplot;
23-
fullLayout[subplot].axisGroup = type;
22+
fullLayout[subplot]._subplot = subplot;
23+
fullLayout[subplot]._axisGroup = type;
2424
axes.push(fullLayout[subplot]);
2525
} else {
2626
Object.keys(fullLayout[subplot])
2727
.filter(key => key.includes('axis'))
2828
.forEach(axis => {
29-
fullLayout[subplot][axis].subplot = subplot;
30-
fullLayout[subplot][axis].axisGroup = type;
29+
fullLayout[subplot][axis]._subplot = subplot;
30+
fullLayout[subplot][axis]._axisGroup = type;
3131

3232
// it should be in plotly.js, but it's not there for geo axes..
3333
if (!fullLayout[subplot][axis]._name) {

0 commit comments

Comments
 (0)