@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
import {
4
4
AxesSelector ,
5
5
AxesRange ,
6
+ CanvasSize ,
6
7
ColorPicker ,
7
8
DataSelector ,
8
9
Dropdown ,
@@ -14,8 +15,10 @@ import {
14
15
PanelMenuWrapper ,
15
16
Radio ,
16
17
Section ,
17
- SubPanel ,
18
+ MenuPanel ,
19
+ SymbolSelector ,
18
20
TraceAccordion ,
21
+ TraceMarkerSection ,
19
22
TraceSelector ,
20
23
} from './components' ;
21
24
import { DEFAULT_FONTS } from './constants' ;
@@ -25,32 +28,6 @@ const LayoutPanel = connectLayoutToPlot(Panel);
25
28
const AxesFold = connectAxesToLayout ( Fold ) ;
26
29
27
30
class DefaultEditor extends Component {
28
- constructor ( props , context ) {
29
- super ( props , context ) ;
30
-
31
- const capitalize = s => s . charAt ( 0 ) . toUpperCase ( ) + s . substring ( 1 ) ;
32
-
33
- // Filter out Polar "area" type as it is fairly broken and we want to present
34
- // scatter with fill as an "area" chart type for convenience.
35
- const traceTypes = Object . keys ( context . plotSchema . traces ) . filter (
36
- t => t !== 'area'
37
- ) ;
38
-
39
- const labels = traceTypes . map ( capitalize ) ;
40
- this . traceOptions = traceTypes . map ( ( t , i ) => ( {
41
- label : labels [ i ] ,
42
- value : t ,
43
- } ) ) ;
44
-
45
- const i = this . traceOptions . findIndex ( opt => opt . value === 'scatter' ) ;
46
- this . traceOptions . splice (
47
- i + 1 ,
48
- 0 ,
49
- { label : 'Line' , value : 'line' } ,
50
- { label : 'Area' , value : 'area' }
51
- ) ;
52
- }
53
-
54
31
render ( ) {
55
32
const _ = this . props . localize ;
56
33
@@ -62,7 +39,6 @@ class DefaultEditor extends Component {
62
39
label = "Plot Type"
63
40
attr = "type"
64
41
clearable = { false }
65
- options = { this . traceOptions }
66
42
show
67
43
/>
68
44
@@ -114,6 +90,18 @@ class DefaultEditor extends Component {
114
90
< Numeric label = { _ ( 'Opacity' ) } step = { 0.1 } attr = "opacity" />
115
91
</ Section >
116
92
93
+ < Section name = { _ ( 'Text Attributes' ) } >
94
+ < Flaglist
95
+ attr = "textinfo"
96
+ options = { [
97
+ { label : 'Label' , value : 'label' } ,
98
+ { label : 'Text' , value : 'text' } ,
99
+ { label : 'Value' , value : 'value' } ,
100
+ { label : '%' , value : 'percent' } ,
101
+ ] }
102
+ />
103
+ </ Section >
104
+
117
105
< Section name = { _ ( 'Display' ) } >
118
106
< Flaglist
119
107
attr = "mode"
@@ -141,25 +129,25 @@ class DefaultEditor extends Component {
141
129
< ColorPicker label = { _ ( 'Color' ) } attr = "fillcolor" />
142
130
</ Section >
143
131
144
- < Section name = { _ ( 'Points' ) } >
145
- < Numeric
146
- label = { _ ( 'Marker Opacity' ) }
147
- step = { 0.1 }
148
- attr = "marker.opacity"
132
+ < TraceMarkerSection >
133
+ < Radio
134
+ attr = "orientation"
135
+ options = { [
136
+ { label : _ ( 'Vertical' ) , value : 'v' } ,
137
+ { label : _ ( 'Horizontal' ) , value : 'h' } ,
138
+ ] }
149
139
/>
150
-
151
- < ColorPicker label = { _ ( 'Marker Color' ) } attr = "marker.color" />
152
-
140
+ < ColorPicker label = { _ ( 'Color' ) } attr = "marker.color" />
141
+ < Numeric label = { _ ( 'Opacity' ) } step = { 0.1 } attr = "marker.opacity" />
153
142
< Numeric label = { _ ( 'Size' ) } attr = "marker.size" />
154
-
155
- < Numeric label = { _ ( 'Line width' ) } attr = "marker.line.width" />
156
- </ Section >
143
+ < SymbolSelector label = { _ ( 'Symbol' ) } attr = "marker.symbol" />
144
+ < Numeric label = { _ ( 'Border Width' ) } attr = "marker.line.width" />
145
+ < ColorPicker label = { _ ( 'Border Color' ) } attr = "marker.line.color" />
146
+ </ TraceMarkerSection >
157
147
158
148
< Section name = { _ ( 'Lines' ) } >
159
149
< Numeric label = { _ ( 'Width' ) } step = { 1.0 } attr = "line.width" />
160
-
161
- < ColorPicker label = { _ ( 'Line color' ) } attr = "line.color" />
162
-
150
+ < ColorPicker label = { _ ( 'Line Color' ) } attr = "line.color" />
163
151
< Radio
164
152
label = { _ ( 'Connect Gaps' ) }
165
153
attr = "connectgaps"
@@ -174,12 +162,43 @@ class DefaultEditor extends Component {
174
162
175
163
< LayoutPanel group = "Style" name = { _ ( 'Layout' ) } >
176
164
< Fold name = { _ ( 'Canvas' ) } >
177
- < Numeric
165
+ < Radio
166
+ attr = "autosize"
167
+ options = { [
168
+ { label : _ ( 'Auto' ) , value : true } ,
169
+ { label : _ ( 'Custom' ) , value : false } ,
170
+ ] }
171
+ />
172
+ < CanvasSize
178
173
label = { _ ( 'Fixed Width' ) }
179
174
step = { 1 }
180
175
attr = "width"
181
176
postfix = "px"
182
177
/>
178
+ < CanvasSize
179
+ label = { _ ( 'Fixed Height' ) }
180
+ step = { 1 }
181
+ attr = "height"
182
+ postfix = "px"
183
+ />
184
+ < ColorPicker label = { _ ( 'Color' ) } attr = "paper_bgcolor" />
185
+ </ Fold >
186
+ < Fold name = { _ ( 'Margins and Padding' ) } >
187
+ < Numeric label = { _ ( 'Top' ) } step = { 1 } attr = "margin.t" postfix = "px" />
188
+ < Numeric
189
+ label = { _ ( 'Bottom' ) }
190
+ step = { 1 }
191
+ attr = "margin.b"
192
+ postfix = "px"
193
+ />
194
+ < Numeric label = { _ ( 'Left' ) } step = { 1 } attr = "margin.l" postfix = "px" />
195
+ < Numeric label = { _ ( 'Right' ) } step = { 1 } attr = "margin.r" postfix = "px" />
196
+ < Numeric
197
+ label = { _ ( 'Padding' ) }
198
+ step = { 1 }
199
+ attr = "margin.pad"
200
+ postfix = "px"
201
+ />
183
202
</ Fold >
184
203
</ LayoutPanel >
185
204
@@ -218,21 +237,21 @@ class DefaultEditor extends Component {
218
237
</ Section >
219
238
</ AxesFold >
220
239
221
- < AxesFold name = { _ ( 'Lines' ) } >
222
- < AxesSelector />
223
- </ AxesFold >
224
- < AxesFold name = { _ ( 'Tick Labels' ) } >
225
- < AxesSelector />
226
- </ AxesFold >
227
- < AxesFold name = { _ ( 'Tick Markers' ) } >
228
- < AxesSelector />
229
- </ AxesFold >
230
- < AxesFold name = { _ ( 'Zoom Interactivity' ) } >
231
- < AxesSelector />
232
- </ AxesFold >
233
- < AxesFold name = { _ ( 'Layout' ) } >
234
- < AxesSelector />
235
- </ AxesFold >
240
+ { /* <AxesFold name={_('Lines')}>
241
+ <AxesSelector />
242
+ </AxesFold>
243
+ <AxesFold name={_('Tick Labels')}>
244
+ <AxesSelector />
245
+ </AxesFold>
246
+ <AxesFold name={_('Tick Markers')}>
247
+ <AxesSelector />
248
+ </AxesFold>
249
+ <AxesFold name={_('Zoom Interactivity')}>
250
+ <AxesSelector />
251
+ </AxesFold>
252
+ <AxesFold name={_('Layout')}>
253
+ <AxesSelector />
254
+ </AxesFold> */ }
236
255
</ LayoutPanel >
237
256
238
257
< LayoutPanel group = "Style" name = { _ ( 'Legend' ) } >
@@ -278,7 +297,7 @@ class DefaultEditor extends Component {
278
297
/>
279
298
</ Section >
280
299
< Section name = { _ ( 'Positioning' ) } >
281
- < SubPanel >
300
+ < MenuPanel >
282
301
< Section name = { _ ( 'Anchor Point' ) } >
283
302
< Info >
284
303
{ _ (
@@ -303,7 +322,7 @@ class DefaultEditor extends Component {
303
322
] }
304
323
/>
305
324
</ Section >
306
- </ SubPanel >
325
+ </ MenuPanel >
307
326
< Numeric
308
327
label = { _ ( 'X Position' ) }
309
328
step = { 0.01 }
@@ -344,7 +363,6 @@ class DefaultEditor extends Component {
344
363
345
364
DefaultEditor . contextTypes = {
346
365
dataSourceNames : PropTypes . array . isRequired ,
347
- plotSchema : PropTypes . object . isRequired ,
348
366
} ;
349
367
350
368
export default localize ( DefaultEditor ) ;
0 commit comments