-
-
Notifications
You must be signed in to change notification settings - Fork 100
/
StyleAxesPanel.js
505 lines (485 loc) · 17.9 KB
/
StyleAxesPanel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {
AxesRange,
DTicks,
DTicksInterval,
NTicks,
ColorPicker,
Dropdown,
FontSelector,
Numeric,
NumericFraction,
Radio,
TextEditor,
PlotlySection,
LayoutPanel,
AxesFold,
AxisSide,
RangesliderVisible,
RangeSelectorAccordion,
VisibilitySelect,
DropdownCustom,
TickFormat,
} from '../components';
class StyleAxesPanel extends Component {
render() {
const {localize: _} = this.context;
return (
<LayoutPanel>
<AxesFold
name={_('Titles')}
axisFilter={axis => !(axis._name.includes('angular') || axis._subplot.includes('geo'))}
>
<TextEditor attr="title.text" />
<FontSelector label={_('Typeface')} attr="title.font.family" />
<Numeric label={_('Font Size')} attr="title.font.size" units="px" />
<ColorPicker label={_('Font Color')} attr="title.font.color" />
</AxesFold>
<AxesFold name={_('Range')}>
<PlotlySection name={_('Range')} attr="autorange">
<Dropdown
attr="type"
label={_('Type')}
clearable={false}
options={[
{label: _('Linear'), value: 'linear'},
{label: _('Log'), value: 'log'},
{label: _('Date'), value: 'date'},
{label: _('Categorical'), value: 'category'},
{label: _('Multicategorical'), value: 'multicategory'},
]}
/>
<Radio
attr="autorange"
label={_('Range')}
options={[
{label: _('Auto'), value: true},
{label: _('Custom'), value: false},
]}
/>
<AxesRange label={_('Min')} attr="range[0]" />
<AxesRange label={_('Max')} attr="range[1]" />
<Numeric label={_('Min')} attr="min" />
</PlotlySection>
<PlotlySection name={_('Zoom Interactivity')} attr="fixedrange">
<Radio
attr="fixedrange"
options={[
{label: _('Enable'), value: false},
{label: _('Disable'), value: true},
]}
/>
</PlotlySection>
<Dropdown
label={_('Direction')}
attr="direction"
options={[
{label: _('Clockwise'), value: 'clockwise'},
{label: _('Counter Clockwise'), value: 'counterclockwise'},
]}
clearable={false}
/>
</AxesFold>
<AxesFold name={_('Lines')}>
<PlotlySection name={_('Axis Line')} attr="showline">
<VisibilitySelect
attr="showline"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
showOn={true}
defaultOpt={true}
>
<Numeric label={_('Thickness')} attr="linewidth" units="px" />
<ColorPicker label={_('Color')} attr="linecolor" />
<AxisSide label={_('Position')} attr="side" />
<Radio
label={_('Mirror Axis')}
attr="mirror"
options={[
{label: _('On'), value: 'ticks'},
{label: _('Off'), value: false},
]}
/>
</VisibilitySelect>
</PlotlySection>
<PlotlySection name={_('Grid Lines')} attr="showgrid">
<VisibilitySelect
attr="showgrid"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
showOn={true}
defaultOpt={true}
>
<Numeric label={_('Thickness')} attr="gridwidth" units="px" />
<ColorPicker label={_('Color')} attr="gridcolor" />
<Radio
label={_('Position On')}
attr="tickson"
options={[
{label: _('Labels'), value: 'labels'},
{label: _('Boundaries'), value: 'boundaries'},
]}
/>
<Radio
label={_('Grid Spacing')}
attr="tickmode"
options={[
{label: _('Auto'), value: 'auto'},
{label: _('Custom'), value: 'linear'},
]}
/>
<DTicks label={_('Step Offset')} attr="tick0" />
<DTicksInterval label={_('Step Size')} attr="dtick" />
<NTicks label={_('Max Number of Lines')} attr="nticks" />
</VisibilitySelect>
</PlotlySection>
<PlotlySection name={_('Zero Line')} attr="zeroline">
<Radio
attr="zeroline"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<Numeric label={_('Thickness')} attr="zerolinewidth" units="px" />
<ColorPicker label={_('Color')} attr="zerolinecolor" />
</PlotlySection>
<PlotlySection name={_('Axis Background')} attr="showbackground">
<Radio
attr="showbackground"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<ColorPicker label={_('Color')} attr="backgroundcolor" />
</PlotlySection>
</AxesFold>
<AxesFold name={_('Tick Labels')} axisFilter={axis => !axis._subplot.includes('geo')}>
<PlotlySection name={_('Tick Labels')} attr="showticklabels">
<VisibilitySelect
attr="showticklabels"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
showOn={true}
defaultOpt={true}
>
<AxisSide label={_('Position')} attr="side" />
<Radio
label={_('Auto margins')}
attr="automargin"
options={[
{label: _('True'), value: true},
{label: _('False'), value: false},
]}
/>
<Radio
label={_('Position on')}
attr="tickson"
options={[
{label: _('Labels'), value: 'labels'},
{label: _('Boundaries'), value: 'boundaries'},
]}
/>
<FontSelector label={_('Typeface')} attr="tickfont.family" />
<Numeric label={_('Font Size')} attr="tickfont.size" units="px" />
<ColorPicker label={_('Font Color')} attr="tickfont.color" />
<Dropdown
label={_('Angle')}
attr="tickangle"
clearable={false}
options={[
{label: _('Auto'), value: 'auto'},
{label: _('45'), value: 45},
{label: _('90'), value: 90},
{label: _('135'), value: 135},
{label: _('180'), value: 180},
]}
/>
<TickFormat
label={_('Label Format')}
attr="tickformat"
dafaultOpt=""
clearable={false}
/>
<Radio
label={_('Separate Thousands')}
attr="separatethousands"
options={[
{label: _('True'), value: true},
{label: _('False'), value: false},
]}
/>
<Dropdown
label={_('Exponents')}
attr="exponentformat"
clearable={false}
options={[
{label: _('None'), value: 'none'},
{label: _('e+6'), value: 'e'},
{label: _('E+6'), value: 'E'},
{label: _('x10^6'), value: 'power'},
{label: _('k/M/G'), value: 'SI'},
{label: _('k/M/B'), value: 'B'},
]}
/>
<Dropdown
label={_('Show Exponents')}
attr="showexponent"
clearable={false}
options={[
{label: _('All'), value: 'all'},
{label: _('First'), value: 'first'},
{label: _('Last'), value: 'last'},
{label: _('None'), value: 'none'},
]}
/>
<DropdownCustom
label={_('Prefix')}
attr="tickprefix"
options={[
{label: _('None'), value: ''},
{label: _('x'), value: 'x'},
{label: _('$'), value: '$'},
{label: _('#'), value: '#'},
{label: _('@'), value: '@'},
{label: _('Custom'), value: 'custom'},
]}
customOpt="custom"
dafaultOpt=""
clearable={false}
/>
<Dropdown
label={_('Show Prefix')}
attr="showtickprefix"
options={[
{label: _('Every label'), value: 'all'},
{label: _('First label'), value: 'first'},
{label: _('Last label'), value: 'last'},
{label: _('None'), value: 'none'},
]}
/>
<DropdownCustom
label={_('Suffix')}
attr="ticksuffix"
options={[
{label: _('None'), value: ''},
{label: _('C'), value: 'C'},
{label: _('%'), value: '%'},
{label: _('^'), value: '^'},
{label: _('Custom'), value: 'custom'},
]}
customOpt="custom"
dafaultOpt=""
clearable={false}
/>
<Dropdown
label={_('Show Suffix')}
attr="showticksuffix"
options={[
{label: _('Every label'), value: 'all'},
{label: _('First label'), value: 'first'},
{label: _('Last label'), value: 'last'},
{label: _('None'), value: 'none'},
]}
/>
<Radio
label={_('Tick Spacing')}
attr="tickmode"
options={[
{label: _('Auto'), value: 'auto'},
{label: _('Custom'), value: 'linear'},
]}
/>
<DTicks label={_('Step Offset')} attr="tick0" />
<DTicksInterval label={_('Step Size')} attr="dtick" />
<NTicks label={_('Max Number of Labels')} attr="nticks" />
</VisibilitySelect>
</PlotlySection>
</AxesFold>
<AxesFold name={_('Tick Markers')} axisFilter={axis => !axis._subplot.includes('geo')}>
<PlotlySection name={_('Tick Markers')} attr="ticks">
<VisibilitySelect
attr="ticks"
options={[
{label: _('Inside'), value: 'inside'},
{label: _('Outside'), value: 'outside'},
{label: _('Hide'), value: ''},
]}
showOn={['inside', 'outside']}
defaultOpt={'Outside'}
>
<AxisSide label={_('Position')} attr="side" />
<Radio
label={_('Position on')}
attr="tickson"
options={[
{label: _('Labels'), value: 'labels'},
{label: _('Boundaries'), value: 'boundaries'},
]}
/>
<Numeric label={_('Length')} attr="ticklen" units="px" />
<Numeric label={_('Width')} attr="tickwidth" units="px" />
<ColorPicker label={_('Color')} attr="tickcolor" />
<Radio
label={_('Tick Spacing')}
attr="tickmode"
options={[
{label: _('Auto'), value: 'auto'},
{label: _('Custom'), value: 'linear'},
]}
/>
<DTicks label={_('Step Offset')} attr="tick0" />
<DTicksInterval label={_('Step Size')} attr="dtick" />
<NTicks label={_('Max Number of Markers')} attr="nticks" />
</VisibilitySelect>
</PlotlySection>
<PlotlySection name={_('Multicategory Dividers')} attr="showdividers">
<VisibilitySelect
attr="showdividers"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
showOn={true}
>
<Numeric label={_('Width')} attr="dividerwidth" units="px" />
<ColorPicker label={_('Color')} attr="dividercolor" />
</VisibilitySelect>
</PlotlySection>
</AxesFold>
<AxesFold name={_('Range Slider')} axisFilter={axis => axis._subplot.includes('xaxis')}>
<RangesliderVisible
attr="rangeslider.visible"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<NumericFraction label={_('Height')} attr="rangeslider.thickness" />
<ColorPicker label={_('Background Color')} attr="rangeslider.bgcolor" />
<Numeric label={_('Border Width')} attr="rangeslider.borderwidth" units="px" />
<ColorPicker label={_('Border Color')} attr="rangeslider.bordercolor" />
</AxesFold>
<AxesFold
name={_('Timescale Buttons')}
axisFilter={axis => axis._subplot.includes('xaxis') && axis.type === 'date'}
>
<Radio
attr="rangeselector.visible"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<RangeSelectorAccordion>
<TextEditor attr="label" label={_('Label')} show />
<Numeric label={_('Count')} attr="count" />
<Dropdown
label={_('Step')}
attr="step"
clearable={false}
options={[
{label: _('Year'), value: 'year'},
{label: _('Month'), value: 'month'},
{label: _('Day'), value: 'day'},
{label: _('Hour'), value: 'hour'},
{label: _('Minute'), value: 'minute'},
{label: _('Second'), value: 'second'},
{label: _('All'), value: 'all'},
]}
/>
<Dropdown
label={_('Stepmode')}
attr="stepmode"
clearable={false}
options={[
{label: _('To Date'), value: 'todate'},
{label: _('Backward'), value: 'backward'},
]}
/>
</RangeSelectorAccordion>
<PlotlySection name={_('Text')}>
<FontSelector label={_('Typeface')} attr="rangeselector.font.family" />
<Numeric label={_('Font Size')} attr="rangeselector.font.size" units="px" />
<ColorPicker label={_('Font Color')} attr="rangeselector.font.color" />
</PlotlySection>
<PlotlySection name={_('Style')}>
<ColorPicker label={_('Background Color')} attr="rangeselector.bgcolor" />
<ColorPicker label={_('Active Color')} attr="rangeselector.activecolor" />
<Numeric label={_('Border Width')} attr="rangeselector.borderwidth" units="px" />
<ColorPicker label={_('Border Color')} attr="rangeselector.bordercolor" />
</PlotlySection>
<PlotlySection name={_('Horizontal Positioning')}>
<Dropdown
label={_('Anchor Point')}
clearable={false}
attr="rangeselector.xanchor"
options={[
{label: _('Auto'), value: 'auto'},
{label: _('Left'), value: 'left'},
{label: _('Center'), value: 'center'},
{label: _('Right'), value: 'right'},
]}
/>
<Numeric label={_('Position')} step={0.02} attr="rangeselector.x" />
</PlotlySection>
<PlotlySection name={_('Vertical Positioning')}>
<Dropdown
label={_('Anchor Point')}
clearable={false}
attr="rangeselector.yanchor"
options={[
{label: _('Auto'), value: 'auto'},
{label: _('Top'), value: 'top'},
{label: _('Middle'), value: 'middle'},
{label: _('Bottom'), value: 'bottom'},
]}
/>
<Numeric label={_('Position')} step={0.02} attr="rangeselector.y" />
</PlotlySection>
</AxesFold>
<AxesFold
name={_('Spike Lines')}
axisFilter={axis =>
!(
axis._subplot.includes('ternary') ||
axis._subplot.includes('polar') ||
axis._subplot.includes('geo')
)
}
>
<Radio
attr="showspikes"
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<Radio
attr="spikesides"
label={_('Show Sides')}
options={[
{label: _('Show'), value: true},
{label: _('Hide'), value: false},
]}
/>
<Numeric label={_('Thickness')} attr="spikethickness" units="px" />
<ColorPicker label={_('Color')} attr="spikecolor" />
</AxesFold>
</LayoutPanel>
);
}
}
StyleAxesPanel.contextTypes = {
fullLayout: PropTypes.object,
localize: PropTypes.func,
};
export default StyleAxesPanel;