Skip to content

Commit 427913e

Browse files
Merge pull request #725 from plotly/piecolorway
add piecolorway, fix scoping issue
2 parents d598549 + 7fe60f7 commit 427913e

File tree

1 file changed

+76
-43
lines changed

1 file changed

+76
-43
lines changed

src/default_panels/StyleTracesPanel.js

Lines changed: 76 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
TraceTypeSection,
1919
TraceMarkerSection,
2020
ColorscalePicker,
21-
PieColorscalePicker,
21+
ColorwayPicker,
2222
HoverInfo,
2323
Dropdown,
2424
FillDropdown,
@@ -50,7 +50,16 @@ const StyleTracesPanel = (props, {localize: _}) => (
5050
/>
5151
<NumericFraction label={_('Trace Opacity')} attr="opacity" />
5252
<MultiColorPicker label={_('Color')} attr="color" />
53-
<PieColorscalePicker label={_('Colors')} attr="marker.colors" />
53+
<TraceTypeSection name={_('Pie Colors')} traceTypes={['pie']} mode="trace">
54+
<LayoutSection attr="name">
55+
<ColorwayPicker label={_('Colors')} attr="piecolorway" />
56+
<Radio
57+
label={_('Extended Colors')}
58+
attr="extendpiecolors"
59+
options={[{label: _('On'), value: true}, {label: _('Off'), value: false}]}
60+
/>
61+
</LayoutSection>
62+
</TraceTypeSection>
5463
<PlotlySection name={_('Values')}>
5564
<BinningDropdown label={_('Histogram Function')} attr="histfunc" />
5665
<Dropdown
@@ -218,45 +227,61 @@ const StyleTracesPanel = (props, {localize: _}) => (
218227
<Numeric label={_('Border Width')} attr="marker.line.width" />
219228
<MultiColorPicker label={_('Border Color')} attr="marker.line.color" />
220229
</TraceMarkerSection>
221-
<LayoutSection name={_('Size and Spacing')}>
222-
<Radio
223-
label={_('Box Mode')}
224-
attr="boxmode"
225-
options={[{label: _('Overlay'), value: 'overlay'}, {label: _('Group'), value: 'group'}]}
226-
/>
227-
<NumericFractionInverse label={_('Box Width')} attr="boxgap" />
228-
<NumericFraction label={_('Box Padding')} attr="boxgroupgap" />
229-
<Dropdown
230-
label={_('Bar Mode')}
231-
attr="barmode"
232-
options={[
233-
{label: _('Overlay'), value: 'overlay'},
234-
{label: _('Group'), value: 'group'},
235-
{label: _('Stack'), value: 'stack'},
236-
{label: _('Relative'), value: 'relative'},
237-
]}
238-
clearable={false}
239-
/>
240-
<Dropdown
241-
label={_('Normalization')}
242-
attr="barnorm"
243-
options={[
244-
{label: _('None'), value: ''},
245-
{label: _('Fraction'), value: 'fraction'},
246-
{label: _('Percent'), value: 'percent'},
247-
]}
248-
clearable={false}
249-
/>
250-
<NumericFractionInverse label={_('Bar Width')} attr="bargap" />
251-
<NumericFraction label={_('Bar Padding')} attr="bargroupgap" />
252-
<Radio
253-
label={_('Violin Mode')}
254-
attr="violinmode"
255-
options={[{label: _('Overlay'), value: 'overlay'}, {label: _('Group'), value: 'group'}]}
256-
/>
257-
<NumericFractionInverse label={_('Violin Width')} attr="violingap" />
258-
<NumericFraction label={_('Violin Padding')} attr="violingroupgap" />
259-
</LayoutSection>
230+
231+
<TraceTypeSection
232+
name={_('Bar Size and Spacing')}
233+
traceTypes={['bar', 'histogram']}
234+
mode="trace"
235+
>
236+
<LayoutSection attr="name">
237+
<Dropdown
238+
label={_('Bar Mode')}
239+
attr="barmode"
240+
options={[
241+
{label: _('Overlay'), value: 'overlay'},
242+
{label: _('Group'), value: 'group'},
243+
{label: _('Stack'), value: 'stack'},
244+
{label: _('Relative'), value: 'relative'},
245+
]}
246+
clearable={false}
247+
/>
248+
<Dropdown
249+
label={_('Normalization')}
250+
attr="barnorm"
251+
options={[
252+
{label: _('None'), value: ''},
253+
{label: _('Fraction'), value: 'fraction'},
254+
{label: _('Percent'), value: 'percent'},
255+
]}
256+
clearable={false}
257+
/>
258+
<NumericFractionInverse label={_('Bar Width')} attr="bargap" />
259+
<NumericFraction label={_('Bar Padding')} attr="bargroupgap" />
260+
</LayoutSection>
261+
</TraceTypeSection>
262+
<TraceTypeSection name={_('Box Size and Spacing')} traceTypes={['box']} mode="trace">
263+
<LayoutSection attr="name">
264+
<Radio
265+
label={_('Box Mode')}
266+
attr="boxmode"
267+
options={[{label: _('Overlay'), value: 'overlay'}, {label: _('Group'), value: 'group'}]}
268+
/>
269+
<NumericFractionInverse label={_('Box Width')} attr="boxgap" />
270+
<NumericFraction label={_('Box Padding')} attr="boxgroupgap" />
271+
</LayoutSection>
272+
</TraceTypeSection>
273+
<TraceTypeSection name={_('Violin Size and Spacing')} traceTypes={['violin']} mode="trace">
274+
<LayoutSection attr="name">
275+
<Radio
276+
label={_('Violin Mode')}
277+
attr="violinmode"
278+
options={[{label: _('Overlay'), value: 'overlay'}, {label: _('Group'), value: 'group'}]}
279+
/>
280+
<NumericFractionInverse label={_('Violin Width')} attr="violingap" />
281+
<NumericFraction label={_('Violin Padding')} attr="violingroupgap" />
282+
</LayoutSection>
283+
</TraceTypeSection>
284+
260285
<NumericFraction label={_('Whisker Width')} attr="whiskerwidth" />
261286
<PlotlySection name={_('Ticks')}>
262287
<Numeric label={_('Width')} attr="tickwidth" />
@@ -276,6 +301,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
276301
'box',
277302
'violin',
278303
]}
304+
mode="trace"
279305
>
280306
<Numeric label={_('Width')} attr="line.width" />
281307
<MultiColorPicker label={_('Color')} attr="line.color" />
@@ -315,6 +341,7 @@ const StyleTracesPanel = (props, {localize: _}) => (
315341
'scattergeo',
316342
'scattermapbox',
317343
]}
344+
mode="trace"
318345
>
319346
<DataSelector label={_('Text')} attr="text" />
320347
<TextPosition label={_('Text Position')} attr="textposition" />
@@ -359,7 +386,11 @@ const StyleTracesPanel = (props, {localize: _}) => (
359386
<Numeric label={_('Horizontal Gaps')} attr="xgap" />
360387
<Numeric label={_('Vertical Gaps')} attr="ygap" />
361388
</PlotlySection>
362-
<TraceTypeSection name={_('Gaps in Data')} traceTypes={['heatmap', 'contour', 'heatmapgl']}>
389+
<TraceTypeSection
390+
name={_('Gaps in Data')}
391+
traceTypes={['heatmap', 'contour', 'heatmapgl']}
392+
mode="trace"
393+
>
363394
<Radio
364395
label={_('Interpolate Gaps')}
365396
attr="connectgaps"
@@ -506,18 +537,20 @@ const StyleTracesPanel = (props, {localize: _}) => (
506537
<TraceTypeSection
507538
name={_('Error Bars X')}
508539
traceTypes={['scatter', 'scattergl', 'scatter3d', 'bar']}
540+
mode="trace"
509541
>
510542
<ErrorBars attr="error_x" />
511543
</TraceTypeSection>
512544

513545
<TraceTypeSection
514546
name={_('Error Bars Y')}
515547
traceTypes={['scatter', 'scattergl', 'scatter3d', 'bar']}
548+
mode="trace"
516549
>
517550
<ErrorBars attr="error_y" />
518551
</TraceTypeSection>
519552

520-
<TraceTypeSection name={_('Error Bars Z')} traceTypes={['scatter3d']}>
553+
<TraceTypeSection name={_('Error Bars Z')} traceTypes={['scatter3d']} mode="trace">
521554
<ErrorBars attr="error_z" />
522555
</TraceTypeSection>
523556
</TraceAccordion>

0 commit comments

Comments
 (0)