Skip to content

Commit 42af3f7

Browse files
committed
Fixes
1 parent 95673d4 commit 42af3f7

File tree

5 files changed

+95
-38
lines changed

5 files changed

+95
-38
lines changed

src/components/containers/TraceMarkerSection.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class TraceMarkerSection extends Component {
1818
const traceType = context.fullContainer.type;
1919
if (['bar', 'histogram'].includes(traceType)) {
2020
this.name = _('Bars');
21+
} else if (traceType === 'pie') {
22+
this.name = _('Segments');
2123
} else {
2224
this.name = _('Points');
2325
}

src/components/fields/derived.js

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,63 @@ function computeAxesRefOptions(axes, propsAttr) {
461461
return options;
462462
}
463463

464+
export const TextPosition = connectToContainer(UnconnectedDropdown, {
465+
modifyPlotProps: (props, context, plotProps) => {
466+
const {localize: _} = props;
467+
let options = [
468+
{label: _('Top Left'), value: 'top left'},
469+
{label: _('Top Center'), value: 'top center'},
470+
{label: _('Top Right'), value: 'top right'},
471+
{label: _('Middle Left'), value: 'middle left'},
472+
{label: _('Middle Center'), value: 'middle center'},
473+
{label: _('Middle Right'), value: 'middle right'},
474+
{label: _('Bottom Left'), value: 'bottom left'},
475+
{label: _('Bottom Center'), value: 'bottom center'},
476+
{label: _('Bottom Right'), value: 'bottom right'},
477+
];
478+
if (context.container.type === 'pie') {
479+
options = [
480+
{label: _('Inside'), value: 'inside'},
481+
{label: _('Outside'), value: 'outside'},
482+
{label: _('Auto'), value: 'auto'},
483+
{label: _('None'), value: 'none'},
484+
];
485+
}
486+
plotProps.options = options;
487+
plotProps.clearable = false;
488+
},
489+
});
490+
464491
export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
465492
modifyPlotProps: (props, context, plotProps) => {
466493
const {localize: _} = props;
467494
let options = [
468495
{label: _('X'), value: 'x'},
469496
{label: _('Y'), value: 'y'},
470-
{label: _('Z'), value: 'z'},
497+
{label: _('Name'), value: 'name'},
471498
];
472499

500+
if (
501+
[
502+
'heatmap',
503+
'heatmapgl',
504+
'histogram2d',
505+
'histogram2dcontour',
506+
'contour',
507+
'contourcarpet',
508+
'scatter3d',
509+
'surface',
510+
'mesh3d',
511+
].includes(context.container.type)
512+
) {
513+
options = [
514+
{label: _('X'), value: 'x'},
515+
{label: _('Y'), value: 'y'},
516+
{label: _('Z'), value: 'z'},
517+
{label: _('Name'), value: 'name'},
518+
];
519+
}
520+
473521
if (context.container.type === 'choropleth') {
474522
options = [
475523
{label: _('Location'), value: 'location'},
@@ -521,6 +569,16 @@ export const HoverInfo = connectToContainer(UnconnectedFlaglist, {
521569
];
522570
}
523571

572+
if (context.container.type === 'pie') {
573+
options = [
574+
{label: _('Label'), value: 'label'},
575+
{label: _('Value'), value: 'value'},
576+
{label: _('Percent'), value: 'percent'},
577+
{label: _('Text'), value: 'text'},
578+
{label: _('Name'), value: 'name'},
579+
];
580+
}
581+
524582
plotProps.options = options;
525583
},
526584
});

src/components/fields/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
TraceOrientation,
3939
AxisOverlayDropdown,
4040
AxisSide,
41+
TextPosition,
4142
} from './derived';
4243
import {LineDashSelector, LineShapeSelector} from './lineSelectors';
4344

@@ -83,4 +84,5 @@ export {
8384
AxisSide,
8485
UpdateMenuButtons,
8586
Dropzone,
87+
TextPosition,
8688
};

src/components/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
TraceSelector,
4141
UpdateMenuButtons,
4242
Dropzone,
43+
TextPosition,
4344
} from './fields';
4445

4546
import {
@@ -135,4 +136,5 @@ export {
135136
TraceTypeSection,
136137
UpdateMenuButtons,
137138
Dropzone,
139+
TextPosition,
138140
};

src/default_panels/StyleTracesPanel.js

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ import {
2424
Dropdown,
2525
FillDropdown,
2626
FontSelector,
27+
TextPosition,
28+
DataSelector,
2729
} from '../components';
2830

2931
import {localize} from '../lib';
3032

3133
const StyleTracesPanel = ({localize: _}) => (
3234
<TraceAccordion canGroup>
3335
<TextEditor label={_('Name')} attr="name" richTextOnly />
36+
<Radio
37+
label="Show in Legend"
38+
attr="showlegend"
39+
options={[
40+
{label: _('Show'), value: true},
41+
{label: _('Hide'), value: false},
42+
]}
43+
/>
3444
<TraceOrientation
3545
label={_('Orientation')}
3646
attr="orientation"
@@ -41,7 +51,14 @@ const StyleTracesPanel = ({localize: _}) => (
4151
/>
4252
<NumericFraction label={_('Opacity')} attr="opacity" />
4353
<ColorPicker label={_('Color')} attr="color" />
44-
54+
<Numeric
55+
showSlider
56+
min={0}
57+
max={1}
58+
step={0.1}
59+
attr="hole"
60+
label={_('Hole')}
61+
/>
4562
<PlotlySection name={_('Text Attributes')}>
4663
<Flaglist
4764
attr="textinfo"
@@ -53,7 +70,6 @@ const StyleTracesPanel = ({localize: _}) => (
5370
]}
5471
/>
5572
</PlotlySection>
56-
5773
<PlotlySection name={_('Header')}>
5874
<Numeric label={_('Height')} attr="header.height" />
5975
<ColorPicker label={_('Fill Color')} attr="header.fill.color" />
@@ -72,7 +88,6 @@ const StyleTracesPanel = ({localize: _}) => (
7288
<Numeric label={_('Border Width')} attr="header.line.width" />
7389
<ColorPicker label={_('Border Color')} attr="header.line.color" />
7490
</PlotlySection>
75-
7691
<PlotlySection name={_('Cells')}>
7792
<Numeric label={_('Height')} attr="cells.height" />
7893
<ColorPicker label={_('Fill Color')} attr="cells.fill.color" />
@@ -91,7 +106,6 @@ const StyleTracesPanel = ({localize: _}) => (
91106
<Numeric label={_('Border Width')} attr="cells.line.width" />
92107
<ColorPicker label={_('Border Color')} attr="cells.line.color" />
93108
</PlotlySection>
94-
95109
<PlotlySection name={_('Display')}>
96110
<Flaglist
97111
attr="mode"
@@ -110,13 +124,19 @@ const StyleTracesPanel = ({localize: _}) => (
110124
]}
111125
/>
112126
</PlotlySection>
113-
114127
<PlotlySection name={_('Filled Area')}>
115128
<FillDropdown attr="fill" label={_('Fill to')} localize={_} />
116129
<ColorPicker label={_('Color')} attr="fillcolor" />
117130
</PlotlySection>
118-
119131
<TraceMarkerSection>
132+
<Radio
133+
label="Order"
134+
attr="sort"
135+
options={[
136+
{label: _('Sorted'), value: true},
137+
{label: _('Unsorted'), value: false},
138+
]}
139+
/>
120140
<Radio
121141
attr="boxpoints"
122142
options={[
@@ -134,28 +154,25 @@ const StyleTracesPanel = ({localize: _}) => (
134154
/>
135155
<ColorscalePicker label={_('Colorscale')} attr="marker.colorscale" />
136156
<ColorPicker label={_('Color')} attr="marker.color" />
157+
<DataSelector label={'Colors'} attr="marker.colors" />
137158
<NumericFraction label={_('Opacity')} attr="marker.opacity" />
138159
<Numeric label={_('Size')} attr="marker.size" />
139160
<SymbolSelector label={_('Symbol')} attr="marker.symbol" />
140161
<Numeric label={_('Border Width')} attr="marker.line.width" />
141162
<ColorPicker label={_('Border Color')} attr="marker.line.color" />
142163
</TraceMarkerSection>
143-
144164
<LayoutSection name={_('Size and Spacing')}>
145165
<NumericFractionInverse label={_('Bar Width')} attr="bargap" />
146166
<NumericFractionInverse label={_('Box Width')} attr="boxgap" />
147167
<NumericFraction label={_('Bar Padding')} attr="bargroupgap" />
148168
<NumericFraction label={_('Box Padding')} attr="boxgroupgap" />
149169
</LayoutSection>
150-
151170
<PlotlySection name={_('Ticks')}>
152171
<Numeric label={_('Width')} attr="tickwidth" />
153172
</PlotlySection>
154-
155173
<PlotlySection name={_('Whiskers')}>
156174
<Numeric label={_('Width')} attr="whiskerwidth" />
157175
</PlotlySection>
158-
159176
<TraceTypeSection
160177
name={_('Lines')}
161178
traceTypes={[
@@ -196,32 +213,19 @@ const StyleTracesPanel = ({localize: _}) => (
196213
]}
197214
/>
198215
</TraceTypeSection>
199-
200216
<TraceTypeSection
201217
name={_('Text')}
202-
traceTypes={['scatter', 'scatterpolar', 'scatterpolargl']}
218+
traceTypes={['scatter', 'scatterpolar', 'scatterpolargl', 'pie']}
203219
>
204220
<FontSelector label={_('Typeface')} attr="textfont.family" />
205221
<Numeric label={_('Font Size')} attr="textfont.size" units="px" />
206222
<ColorPicker label={_('Font Color')} attr="textfont.color" />
207-
<Dropdown
223+
<TextPosition
208224
label={_('Text Position')}
209225
attr="textposition"
210-
clearable={false}
211-
options={[
212-
{label: _('Top Left'), value: 'top left'},
213-
{label: _('Top Center'), value: 'top center'},
214-
{label: _('Top Right'), value: 'top right'},
215-
{label: _('Middle Left'), value: 'middle left'},
216-
{label: _('Middle Center'), value: 'middle center'},
217-
{label: _('Middle Right'), value: 'middle right'},
218-
{label: _('Bottom Left'), value: 'bottom left'},
219-
{label: _('Bottom Center'), value: 'bottom center'},
220-
{label: _('Bottom Right'), value: 'bottom right'},
221-
]}
226+
localize={_}
222227
/>
223228
</TraceTypeSection>
224-
225229
<PlotlySection name={_('Colorscale')}>
226230
<ColorscalePicker label={_('Colorscale')} attr="colorscale" />
227231
<Radio
@@ -251,12 +255,10 @@ const StyleTracesPanel = ({localize: _}) => (
251255
]}
252256
/>
253257
</PlotlySection>
254-
255258
<PlotlySection name={_('Heatmap')}>
256259
<Numeric label={_('Horizontal Gaps')} attr="xgap" />
257260
<Numeric label={_('Vertical Gaps')} attr="ygap" />
258261
</PlotlySection>
259-
260262
<TraceTypeSection
261263
name={_('Gaps in Data')}
262264
traceTypes={['heatmap', 'contour', 'heatmapgl']}
@@ -270,7 +272,6 @@ const StyleTracesPanel = ({localize: _}) => (
270272
]}
271273
/>
272274
</TraceTypeSection>
273-
274275
<PlotlySection name={_('Contours')}>
275276
<Radio
276277
label={_('Coloring')}
@@ -303,7 +304,6 @@ const StyleTracesPanel = ({localize: _}) => (
303304
<ContourNumeric label={_('Min Contour')} attr="contours.start" />
304305
<ContourNumeric label={_('Max Contour')} attr="contours.end" />
305306
</PlotlySection>
306-
307307
<PlotlySection name={_('Lighting')}>
308308
<NumericFraction label={_('Ambient')} attr="lighting.ambient" />
309309
<NumericFraction label={_('Diffuse')} attr="lighting.diffuse" />
@@ -319,13 +319,11 @@ const StyleTracesPanel = ({localize: _}) => (
319319
attr="lighting.facenormalsepsilon"
320320
/>
321321
</PlotlySection>
322-
323322
<PlotlySection name={_('Light Position')}>
324323
<NumericFraction label={_('X')} attr="lightposition.x" />
325324
<NumericFraction label={_('Y')} attr="lightposition.y" />
326325
<NumericFraction label={_('Z')} attr="lightposition.z" />
327326
</PlotlySection>
328-
329327
<PlotlySection name={_('Increasing Trace Styles')}>
330328
<TextEditor label={_('Name')} attr="increasing.name" richTextOnly />
331329
<Numeric label={_('Width')} attr="increasing.line.width" />
@@ -341,7 +339,6 @@ const StyleTracesPanel = ({localize: _}) => (
341339
]}
342340
/>
343341
</PlotlySection>
344-
345342
<PlotlySection name={_('Decreasing Trace Styles')}>
346343
<TextEditor label={_('Name')} attr="decreasing.name" richTextOnly />
347344
<Numeric label={_('Width')} attr="decreasing.line.width" />
@@ -357,7 +354,6 @@ const StyleTracesPanel = ({localize: _}) => (
357354
]}
358355
/>
359356
</PlotlySection>
360-
361357
<PlotlySection name={_('Highlight')}>
362358
<Radio
363359
attr="boxmean"
@@ -376,7 +372,6 @@ const StyleTracesPanel = ({localize: _}) => (
376372
]}
377373
/>
378374
</PlotlySection>
379-
380375
<PlotlySection name={_('On Hover')}>
381376
<HoverInfo
382377
attr="hoverinfo"
@@ -394,7 +389,6 @@ const StyleTracesPanel = ({localize: _}) => (
394389
<ColorPicker label={_('Contour Color')} attr="contour.color" />
395390
<Numeric label={_('Contour Width')} attr="contour.width" />
396391
</PlotlySection>
397-
398392
<TraceTypeSection name={_('Hover Action')} traceTypes={['box']}>
399393
<Flaglist
400394
attr="hoveron"
@@ -405,7 +399,6 @@ const StyleTracesPanel = ({localize: _}) => (
405399
]}
406400
/>
407401
</TraceTypeSection>
408-
409402
<TraceTypeSection
410403
name={_('Hover Action')}
411404
traceTypes={[

0 commit comments

Comments
 (0)