Skip to content

Commit 59e31f2

Browse files
committed
Review comments
1 parent 94bf796 commit 59e31f2

File tree

2 files changed

+32
-29
lines changed

2 files changed

+32
-29
lines changed

src/default_panels/StyleAxesPanel.js

+30-6
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,20 @@ class StyleAxesPanel extends Component {
5555
},
5656
]}
5757
>
58-
<AxesFold name={_('Titles')}>
58+
<AxesFold
59+
name={_('Titles')}
60+
axisFilter={axis => !axis._name.includes('angular')}
61+
>
5962
<TextEditor attr="title" />
6063
<FontSelector label={_('Typeface')} attr="titlefont.family" />
6164
<Numeric label={_('Font Size')} attr="titlefont.size" units="px" />
6265
<ColorPicker label={_('Font Color')} attr="titlefont.color" />
6366
</AxesFold>
6467

65-
<AxesFold name={_('Layout')}>
68+
<AxesFold
69+
name={_('Layout')}
70+
axisFilter={axis => !axis._name.includes('radial')}
71+
>
6672
<Dropdown
6773
label={_('Direction')}
6874
attr="direction"
@@ -347,7 +353,10 @@ class StyleAxesPanel extends Component {
347353
</Section>
348354
</AxesFold>
349355

350-
<AxesFold name={_('Range Slider')}>
356+
<AxesFold
357+
name={_('Range Slider')}
358+
axisFilter={axis => axis._subplot.includes('xaxis')}
359+
>
351360
<RangesliderVisible
352361
attr="rangeslider.visible"
353362
options={[
@@ -371,7 +380,12 @@ class StyleAxesPanel extends Component {
371380
/>
372381
</AxesFold>
373382

374-
<AxesFold name={_('Timescale Buttons')}>
383+
<AxesFold
384+
name={_('Timescale Buttons')}
385+
axisFilter={axis =>
386+
axis._subplot.includes('xaxis') && axis.type === 'date'
387+
}
388+
>
375389
<RangeselectorVisible
376390
attr="rangeselector.visible"
377391
options={[
@@ -471,7 +485,12 @@ class StyleAxesPanel extends Component {
471485
</Section>
472486
</AxesFold>
473487

474-
<AxesFold name={_('Zoom Interactivity')}>
488+
<AxesFold
489+
name={_('Zoom Interactivity')}
490+
axisFilter={axis =>
491+
!axis._name.includes('angular') && !axis._name.includes('radial')
492+
}
493+
>
475494
<Radio
476495
attr="fixedrange"
477496
options={[
@@ -481,7 +500,12 @@ class StyleAxesPanel extends Component {
481500
/>
482501
</AxesFold>
483502

484-
<AxesFold name={_('Hover Projections')}>
503+
<AxesFold
504+
name={_('Hover Projections')}
505+
axisFilter={axis =>
506+
!axis._name.includes('angular') && !axis._name.includes('radial')
507+
}
508+
>
485509
<Radio
486510
attr="showspikes"
487511
options={[

src/lib/connectAxesToLayout.js

+2-23
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,8 @@ import {
1313
function computeAxesOptions(axes, props) {
1414
const _ = props.localize;
1515
let filteredAxes = axes;
16-
17-
if (props.name === 'Range Slider') {
18-
filteredAxes = axes.filter(axis => axis._subplot.includes('xaxis'));
19-
}
20-
21-
if (props.name === 'Timescale Buttons') {
22-
filteredAxes = axes.filter(
23-
axis => axis._subplot.includes('xaxis') && axis.type === 'date'
24-
);
25-
}
26-
27-
if (props.name === 'Titles') {
28-
filteredAxes = axes.filter(axis => !axis._name.includes('angular'));
29-
}
30-
31-
if (['Zoom Interactivity', 'Hover Projections'].includes(props.name)) {
32-
filteredAxes = axes.filter(
33-
axis => !axis._name.includes('angular') && !axis._name.includes('radial')
34-
);
35-
}
36-
37-
if (props.name === 'Layout') {
38-
filteredAxes = axes.filter(axis => !axis._name.includes('radial'));
16+
if (props.axisFilter) {
17+
filteredAxes = axes.filter(props.axisFilter);
3918
}
4019

4120
const options = [];

0 commit comments

Comments
 (0)