@@ -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 ,
@@ -17,6 +18,7 @@ import {
17
18
MenuPanel ,
18
19
SymbolSelector ,
19
20
TraceAccordion ,
21
+ TraceMarkerSection ,
20
22
TraceSelector ,
21
23
} from './components' ;
22
24
import { DEFAULT_FONTS } from './constants' ;
@@ -26,32 +28,6 @@ const LayoutPanel = connectLayoutToPlot(Panel);
26
28
const AxesFold = connectAxesToLayout ( Fold ) ;
27
29
28
30
class DefaultEditor extends Component {
29
- constructor ( props , context ) {
30
- super ( props , context ) ;
31
-
32
- const capitalize = s => s . charAt ( 0 ) . toUpperCase ( ) + s . substring ( 1 ) ;
33
-
34
- // Filter out Polar "area" type as it is fairly broken and we want to present
35
- // scatter with fill as an "area" chart type for convenience.
36
- const traceTypes = Object . keys ( context . plotSchema . traces ) . filter (
37
- t => t !== 'area'
38
- ) ;
39
-
40
- const labels = traceTypes . map ( capitalize ) ;
41
- this . traceOptions = traceTypes . map ( ( t , i ) => ( {
42
- label : labels [ i ] ,
43
- value : t ,
44
- } ) ) ;
45
-
46
- const i = this . traceOptions . findIndex ( opt => opt . value === 'scatter' ) ;
47
- this . traceOptions . splice (
48
- i + 1 ,
49
- 0 ,
50
- { label : 'Line' , value : 'line' } ,
51
- { label : 'Area' , value : 'area' }
52
- ) ;
53
- }
54
-
55
31
render ( ) {
56
32
const _ = this . props . localize ;
57
33
@@ -63,7 +39,6 @@ class DefaultEditor extends Component {
63
39
label = "Plot Type"
64
40
attr = "type"
65
41
clearable = { false }
66
- options = { this . traceOptions }
67
42
show
68
43
/>
69
44
@@ -115,6 +90,18 @@ class DefaultEditor extends Component {
115
90
< Numeric label = { _ ( 'Opacity' ) } step = { 0.1 } attr = "opacity" />
116
91
</ Section >
117
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
+
118
105
< Section name = { _ ( 'Display' ) } >
119
106
< Flaglist
120
107
attr = "mode"
@@ -142,14 +129,21 @@ class DefaultEditor extends Component {
142
129
< ColorPicker label = { _ ( 'Color' ) } attr = "fillcolor" />
143
130
</ Section >
144
131
145
- < Section name = { _ ( 'Points' ) } >
132
+ < TraceMarkerSection >
133
+ < Radio
134
+ attr = "orientation"
135
+ options = { [
136
+ { label : _ ( 'Vertical' ) , value : 'v' } ,
137
+ { label : _ ( 'Horizontal' ) , value : 'h' } ,
138
+ ] }
139
+ />
146
140
< ColorPicker label = { _ ( 'Color' ) } attr = "marker.color" />
147
141
< Numeric label = { _ ( 'Opacity' ) } step = { 0.1 } attr = "marker.opacity" />
148
142
< Numeric label = { _ ( 'Size' ) } attr = "marker.size" />
149
143
< SymbolSelector label = { _ ( 'Symbol' ) } attr = "marker.symbol" />
150
144
< Numeric label = { _ ( 'Border Width' ) } attr = "marker.line.width" />
151
145
< ColorPicker label = { _ ( 'Border Color' ) } attr = "marker.line.color" />
152
- </ Section >
146
+ </ TraceMarkerSection >
153
147
154
148
< Section name = { _ ( 'Lines' ) } >
155
149
< Numeric label = { _ ( 'Width' ) } step = { 1.0 } attr = "line.width" />
@@ -168,12 +162,43 @@ class DefaultEditor extends Component {
168
162
169
163
< LayoutPanel group = "Style" name = { _ ( 'Layout' ) } >
170
164
< Fold name = { _ ( 'Canvas' ) } >
171
- < Numeric
165
+ < Radio
166
+ attr = "autosize"
167
+ options = { [
168
+ { label : _ ( 'Auto' ) , value : true } ,
169
+ { label : _ ( 'Custom' ) , value : false } ,
170
+ ] }
171
+ />
172
+ < CanvasSize
172
173
label = { _ ( 'Fixed Width' ) }
173
174
step = { 1 }
174
175
attr = "width"
175
176
postfix = "px"
176
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
+ />
177
202
</ Fold >
178
203
</ LayoutPanel >
179
204
@@ -212,21 +237,21 @@ class DefaultEditor extends Component {
212
237
</ Section >
213
238
</ AxesFold >
214
239
215
- < AxesFold name = { _ ( 'Lines' ) } >
216
- < AxesSelector />
217
- </ AxesFold >
218
- < AxesFold name = { _ ( 'Tick Labels' ) } >
219
- < AxesSelector />
220
- </ AxesFold >
221
- < AxesFold name = { _ ( 'Tick Markers' ) } >
222
- < AxesSelector />
223
- </ AxesFold >
224
- < AxesFold name = { _ ( 'Zoom Interactivity' ) } >
225
- < AxesSelector />
226
- </ AxesFold >
227
- < AxesFold name = { _ ( 'Layout' ) } >
228
- < AxesSelector />
229
- </ 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> */ }
230
255
</ LayoutPanel >
231
256
232
257
< LayoutPanel group = "Style" name = { _ ( 'Legend' ) } >
@@ -338,7 +363,6 @@ class DefaultEditor extends Component {
338
363
339
364
DefaultEditor . contextTypes = {
340
365
dataSourceNames : PropTypes . array . isRequired ,
341
- plotSchema : PropTypes . object . isRequired ,
342
366
} ;
343
367
344
368
export default localize ( DefaultEditor ) ;
0 commit comments