Skip to content

Commit 5c4a472

Browse files
committed
Review comments
1 parent c3f2c0b commit 5c4a472

File tree

8 files changed

+25
-34
lines changed

8 files changed

+25
-34
lines changed

src/components/containers/derived.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,22 @@ const LayoutPanel = connectLayoutToPlot(Panel);
99

1010
const TraceTypeSection = (props, context) => {
1111
const {fullContainer, fullData} = context;
12-
// when TraceTypeSection is used in a connectedToTrace context
13-
if (
12+
13+
const ifConnectedToTrace =
1414
fullContainer &&
1515
((fullContainer._fullInput &&
1616
props.traceTypes.includes(fullContainer._fullInput.type)) ||
17-
props.traceTypes.includes(fullContainer.type))
18-
) {
19-
return <Section {...props} />;
20-
}
17+
props.traceTypes.includes(fullContainer.type));
2118

22-
// when TraceTypeSection is used in a connectedToLayout context
23-
if (
19+
const ifConnectedToLayout =
2420
fullData &&
2521
fullData.some(
2622
t =>
2723
props.traceTypes.includes(t._fullInput.type) ||
2824
fullData.some(t => props.traceTypes.includes(t.type))
29-
)
30-
) {
25+
);
26+
27+
if (ifConnectedToTrace || ifConnectedToLayout) {
3128
return <Section {...props} />;
3229
}
3330

src/components/fields/__tests__/AnnotationRef-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ describe('<AnnotationRef>', () => {
2727
const options = drop.first().prop('options');
2828
expect(options.length).toBe(3);
2929
expect(options[0]).toEqual({label: 'Canvas', value: 'paper'});
30-
expect(options[1]).toEqual({label: 'Y Axis 1', value: 'y'});
31-
expect(options[2]).toEqual({label: 'Y Axis: yaxis2 title', value: 'y2'});
30+
expect(options[1]).toEqual({label: 'Y 1', value: 'y'});
31+
expect(options[2]).toEqual({label: 'Y: yaxis2 title', value: 'y2'});
3232
});
3333

3434
it('sends update for a[x|y]ref attr on [x|y]ref change', () => {
@@ -114,7 +114,7 @@ describe('<AnnotationArrowRef>', () => {
114114
const options = drop.first().prop('options');
115115
expect(options.length).toBe(3);
116116
expect(options[0]).toEqual({label: 'in pixels', value: 'pixel'});
117-
expect(options[1]).toEqual({label: 'Y Axis 1', value: 'y'});
118-
expect(options[2]).toEqual({label: 'Y Axis: yaxis2 title', value: 'y2'});
117+
expect(options[1]).toEqual({label: 'Y 1', value: 'y'});
118+
expect(options[2]).toEqual({label: 'Y: yaxis2 title', value: 'y2'});
119119
});
120120
});

src/components/fields/derived.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export const AxisAnchorDropdown = connectToContainer(UnconnectedDropdown, {
4141
}
4242
options.push({label: _('Free'), value: 'free'});
4343
plotProps.options = options;
44-
plotProps.clearable = false;
4544
},
4645
});
4746

@@ -131,7 +130,7 @@ export const AxisSide = connectToContainer(UnconnectedRadio, {
131130
return;
132131
}
133132

134-
plotProps.options = [{label: _('Mixed Values'), value: 'mixed values'}];
133+
plotProps.isVisible = false;
135134
},
136135
});
137136

@@ -265,12 +264,6 @@ UnconnectedNumericFraction.defaultProps = {
265264
showSlider: true,
266265
};
267266

268-
class UnconnectedNumericSlider extends UnconnectedNumeric {}
269-
UnconnectedNumericSlider.propTypes = UnconnectedNumeric.propTypes;
270-
UnconnectedNumericSlider.defaultProps = {
271-
showSlider: true,
272-
};
273-
274267
const numericFractionModifyPlotProps = (props, context, plotProps) => {
275268
const {attrMeta, fullValue, updatePlot} = plotProps;
276269
const min = attrMeta.min || 0;
@@ -313,8 +306,8 @@ export const LayoutNumericFraction = connectLayoutToPlot(
313306
})
314307
);
315308

316-
export const LayoutNumericSlider = connectLayoutToPlot(
317-
connectToContainer(UnconnectedNumericSlider, {
309+
export const LayoutNumeric = connectLayoutToPlot(
310+
connectToContainer(UnconnectedNumeric, {
318311
supplyPlotProps: supplyLayoutPlotProps,
319312
})
320313
);

src/components/fields/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
PositioningNumeric,
3838
NumericFractionInverse,
3939
LayoutNumericFraction,
40-
LayoutNumericSlider,
40+
LayoutNumeric,
4141
LayoutNumericFractionInverse,
4242
RangesliderVisible,
4343
RangeselectorVisible,
@@ -72,7 +72,7 @@ export {
7272
HoverInfo,
7373
Info,
7474
LayoutNumericFraction,
75-
LayoutNumericSlider,
75+
LayoutNumeric,
7676
LayoutNumericFractionInverse,
7777
NumericFraction,
7878
NumericFractionDomain,

src/components/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
HoverInfo,
2626
Info,
2727
LayoutNumericFraction,
28-
LayoutNumericSlider,
28+
LayoutNumeric,
2929
LayoutNumericFractionInverse,
3030
NumericFraction,
3131
NumericFractionDomain,
@@ -114,7 +114,7 @@ export {
114114
PositioningNumeric,
115115
NumericFractionInverse,
116116
LayoutNumericFraction,
117-
LayoutNumericSlider,
117+
LayoutNumeric,
118118
LayoutNumericFractionInverse,
119119
LayoutPanel,
120120
LineDashSelector,

src/default_panels/GraphCreatePanel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
TextEditor,
1515
Numeric,
1616
TraceTypeSection,
17-
LayoutNumericSlider,
17+
LayoutNumeric,
1818
} from '../components';
1919
import {localize} from '../lib';
2020

@@ -84,14 +84,14 @@ const GraphCreatePanel = ({localize: _}) => {
8484
attr="thetaunit"
8585
clearable={false}
8686
/>
87-
<LayoutNumericSlider
87+
<LayoutNumeric
8888
attr="polar.sector[0]"
8989
label={_('Theta Start')}
9090
min={0}
9191
max={360}
9292
showSlider
9393
/>
94-
<LayoutNumericSlider
94+
<LayoutNumeric
9595
attr="polar.sector[1]"
9696
label={_('Theta End')}
9797
min={0}

src/default_panels/StyleAxesPanel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
} from '../components';
2626

2727
import {localize} from '../lib';
28+
import {TRACE_TO_AXIS} from '../lib/constants';
2829

2930
class StyleAxesPanel extends Component {
3031
constructor(props, context) {
@@ -86,7 +87,7 @@ class StyleAxesPanel extends Component {
8687

8788
<TraceTypeSection
8889
name={_('Anchor')}
89-
traceTypes={['scatter', 'scattergl']}
90+
traceTypes={TRACE_TO_AXIS.cartesian}
9091
>
9192
<AxisAnchorDropdown
9293
label={_('Anchor To')}

src/lib/getAllAxes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ export function getAxisTitle(axis) {
7979
const subplotNb = getSubplotNumber(axis);
8080

8181
return axis._input && axis._input.title
82-
? striptags(`${axisType} Axis: ${axis._input.title}`)
83-
: striptags(`${axisType} Axis ${subplotNb === 0 ? 1 : subplotNb}`);
82+
? striptags(`${axisType}: ${axis._input.title}`)
83+
: striptags(`${axisType} ${subplotNb === 0 ? 1 : subplotNb}`);
8484
}

0 commit comments

Comments
 (0)