Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f81ca4d

Browse filesBrowse files
authored
Merge pull request plotly#1999 from plotly/edit-refactor
restyle/relayout refactor
2 parents d78b965 + 407ae5a commit f81ca4d
Copy full SHA for f81ca4d

File tree

150 files changed

+3542
-1471
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

150 files changed

+3542
-1471
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"gzip-size": "^3.0.0",
120120
"image-size": "^0.5.1",
121121
"jasmine-core": "^2.4.1",
122+
"jsdom": "^11.2.0",
122123
"karma": "^1.5.0",
123124
"karma-browserify": "^5.1.1",
124125
"karma-chrome-launcher": "^2.0.0",

‎src/components/annotations/arrow_paths.js

Copy file name to clipboardExpand all lines: src/components/annotations/arrow_paths.js
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
'use strict';
1010

1111
/**
12-
* centerx is a center of scaling tuned for maximum scalability of
13-
* the arrowhead ie throughout mag=0.3..3 the head is joined smoothly
14-
* to the line, but the endpoint moves.
15-
* backoff is the distance to move the arrowhead, and the end of the
16-
* line, in order to end at the right place
17-
*
18-
* TODO: option to have the pointed-to point a little in front of the
19-
* end of the line, as people tend to want a bit of a gap there...
12+
* All paths are tuned for maximum scalability of the arrowhead,
13+
* ie throughout arrowwidth=0.3..3 the head is joined smoothly
14+
* to the line, with the line coming from the left and ending at (0, 0).
15+
* `backoff` is the distance to move the arrowhead and the end of the line,
16+
* in order that the arrowhead points to the desired place, either at
17+
* the tip of the arrow or (in the case of circle or square)
18+
* the center of the symbol.
2019
*/
2120

2221
module.exports = [

‎src/components/annotations/attributes.js

Copy file name to clipboardExpand all lines: src/components/annotations/attributes.js
+51-6Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
var ARROWPATHS = require('./arrow_paths');
1212
var fontAttrs = require('../../plots/font_attributes');
1313
var cartesianConstants = require('../../plots/cartesian/constants');
14-
var extendFlat = require('../../lib/extend').extendFlat;
1514

1615

1716
module.exports = {
@@ -21,6 +20,7 @@ module.exports = {
2120
valType: 'boolean',
2221
role: 'info',
2322
dflt: true,
23+
editType: 'calcIfAutorange',
2424
description: [
2525
'Determines whether or not this annotation is visible.'
2626
].join(' ')
@@ -29,6 +29,7 @@ module.exports = {
2929
text: {
3030
valType: 'string',
3131
role: 'info',
32+
editType: 'calcIfAutorange',
3233
description: [
3334
'Sets the text associated with this annotation.',
3435
'Plotly uses a subset of HTML tags to do things like',
@@ -41,19 +42,23 @@ module.exports = {
4142
valType: 'angle',
4243
dflt: 0,
4344
role: 'style',
45+
editType: 'calcIfAutorange',
4446
description: [
4547
'Sets the angle at which the `text` is drawn',
4648
'with respect to the horizontal.'
4749
].join(' ')
4850
},
49-
font: extendFlat({}, fontAttrs, {
51+
font: fontAttrs({
52+
editType: 'calcIfAutorange',
53+
colorEditType: 'arraydraw',
5054
description: 'Sets the annotation text font.'
5155
}),
5256
width: {
5357
valType: 'number',
5458
min: 1,
5559
dflt: null,
5660
role: 'style',
61+
editType: 'calcIfAutorange',
5762
description: [
5863
'Sets an explicit width for the text box. null (default) lets the',
5964
'text set the box width. Wider text will be clipped.',
@@ -65,6 +70,7 @@ module.exports = {
6570
min: 1,
6671
dflt: null,
6772
role: 'style',
73+
editType: 'calcIfAutorange',
6874
description: [
6975
'Sets an explicit height for the text box. null (default) lets the',
7076
'text set the box height. Taller text will be clipped.'
@@ -76,13 +82,15 @@ module.exports = {
7682
max: 1,
7783
dflt: 1,
7884
role: 'style',
85+
editType: 'arraydraw',
7986
description: 'Sets the opacity of the annotation (text + arrow).'
8087
},
8188
align: {
8289
valType: 'enumerated',
8390
values: ['left', 'center', 'right'],
8491
dflt: 'center',
8592
role: 'style',
93+
editType: 'arraydraw',
8694
description: [
8795
'Sets the horizontal alignment of the `text` within the box.',
8896
'Has an effect only if `text` spans more two or more lines',
@@ -95,6 +103,7 @@ module.exports = {
95103
values: ['top', 'middle', 'bottom'],
96104
dflt: 'middle',
97105
role: 'style',
106+
editType: 'arraydraw',
98107
description: [
99108
'Sets the vertical alignment of the `text` within the box.',
100109
'Has an effect only if an explicit height is set to override',
@@ -105,12 +114,14 @@ module.exports = {
105114
valType: 'color',
106115
dflt: 'rgba(0,0,0,0)',
107116
role: 'style',
117+
editType: 'arraydraw',
108118
description: 'Sets the background color of the annotation.'
109119
},
110120
bordercolor: {
111121
valType: 'color',
112122
dflt: 'rgba(0,0,0,0)',
113123
role: 'style',
124+
editType: 'arraydraw',
114125
description: [
115126
'Sets the color of the border enclosing the annotation `text`.'
116127
].join(' ')
@@ -120,6 +131,7 @@ module.exports = {
120131
min: 0,
121132
dflt: 1,
122133
role: 'style',
134+
editType: 'calcIfAutorange',
123135
description: [
124136
'Sets the padding (in px) between the `text`',
125137
'and the enclosing border.'
@@ -130,6 +142,7 @@ module.exports = {
130142
min: 0,
131143
dflt: 1,
132144
role: 'style',
145+
editType: 'calcIfAutorange',
133146
description: [
134147
'Sets the width (in px) of the border enclosing',
135148
'the annotation `text`.'
@@ -140,6 +153,7 @@ module.exports = {
140153
valType: 'boolean',
141154
dflt: true,
142155
role: 'style',
156+
editType: 'calcIfAutorange',
143157
description: [
144158
'Determines whether or not the annotation is drawn with an arrow.',
145159
'If *true*, `text` is placed near the arrow\'s tail.',
@@ -149,6 +163,7 @@ module.exports = {
149163
arrowcolor: {
150164
valType: 'color',
151165
role: 'style',
166+
editType: 'arraydraw',
152167
description: 'Sets the color of the annotation arrow.'
153168
},
154169
arrowhead: {
@@ -157,26 +172,33 @@ module.exports = {
157172
max: ARROWPATHS.length,
158173
dflt: 1,
159174
role: 'style',
175+
editType: 'arraydraw',
160176
description: 'Sets the annotation arrow head style.'
161177
},
162178
arrowsize: {
163179
valType: 'number',
164180
min: 0.3,
165181
dflt: 1,
166182
role: 'style',
167-
description: 'Sets the size (in px) of annotation arrow head.'
183+
editType: 'calcIfAutorange',
184+
description: [
185+
'Sets the size of the annotation arrow head, relative to `arrowwidth`.',
186+
'A value of 1 (default) gives a head about 3x as wide as the line.'
187+
].join(' ')
168188
},
169189
arrowwidth: {
170190
valType: 'number',
171191
min: 0.1,
172192
role: 'style',
173-
description: 'Sets the width (in px) of annotation arrow.'
193+
editType: 'calcIfAutorange',
194+
description: 'Sets the width (in px) of annotation arrow line.'
174195
},
175196
standoff: {
176197
valType: 'number',
177198
min: 0,
178199
dflt: 0,
179200
role: 'style',
201+
editType: 'calcIfAutorange',
180202
description: [
181203
'Sets a distance, in pixels, to move the arrowhead away from the',
182204
'position it is pointing at, for example to point at the edge of',
@@ -188,6 +210,7 @@ module.exports = {
188210
ax: {
189211
valType: 'any',
190212
role: 'info',
213+
editType: 'calcIfAutorange',
191214
description: [
192215
'Sets the x component of the arrow tail about the arrow head.',
193216
'If `axref` is `pixel`, a positive (negative) ',
@@ -200,6 +223,7 @@ module.exports = {
200223
ay: {
201224
valType: 'any',
202225
role: 'info',
226+
editType: 'calcIfAutorange',
203227
description: [
204228
'Sets the y component of the arrow tail about the arrow head.',
205229
'If `ayref` is `pixel`, a positive (negative) ',
@@ -217,6 +241,7 @@ module.exports = {
217241
cartesianConstants.idRegex.x.toString()
218242
],
219243
role: 'info',
244+
editType: 'calc',
220245
description: [
221246
'Indicates in what terms the tail of the annotation (ax,ay) ',
222247
'is specified. If `pixel`, `ax` is a relative offset in pixels ',
@@ -234,6 +259,7 @@ module.exports = {
234259
cartesianConstants.idRegex.y.toString()
235260
],
236261
role: 'info',
262+
editType: 'calc',
237263
description: [
238264
'Indicates in what terms the tail of the annotation (ax,ay) ',
239265
'is specified. If `pixel`, `ay` is a relative offset in pixels ',
@@ -251,6 +277,7 @@ module.exports = {
251277
cartesianConstants.idRegex.x.toString()
252278
],
253279
role: 'info',
280+
editType: 'calc',
254281
description: [
255282
'Sets the annotation\'s x coordinate axis.',
256283
'If set to an x axis id (e.g. *x* or *x2*), the `x` position',
@@ -263,6 +290,7 @@ module.exports = {
263290
x: {
264291
valType: 'any',
265292
role: 'info',
293+
editType: 'calcIfAutorange',
266294
description: [
267295
'Sets the annotation\'s x position.',
268296
'If the axis `type` is *log*, then you must take the',
@@ -280,6 +308,7 @@ module.exports = {
280308
values: ['auto', 'left', 'center', 'right'],
281309
dflt: 'auto',
282310
role: 'info',
311+
editType: 'calcIfAutorange',
283312
description: [
284313
'Sets the text box\'s horizontal position anchor',
285314
'This anchor binds the `x` position to the *left*, *center*',
@@ -298,6 +327,7 @@ module.exports = {
298327
valType: 'number',
299328
dflt: 0,
300329
role: 'style',
330+
editType: 'calcIfAutorange',
301331
description: [
302332
'Shifts the position of the whole annotation and arrow to the',
303333
'right (positive) or left (negative) by this many pixels.'
@@ -310,6 +340,7 @@ module.exports = {
310340
cartesianConstants.idRegex.y.toString()
311341
],
312342
role: 'info',
343+
editType: 'calc',
313344
description: [
314345
'Sets the annotation\'s y coordinate axis.',
315346
'If set to an y axis id (e.g. *y* or *y2*), the `y` position',
@@ -322,6 +353,7 @@ module.exports = {
322353
y: {
323354
valType: 'any',
324355
role: 'info',
356+
editType: 'calcIfAutorange',
325357
description: [
326358
'Sets the annotation\'s y position.',
327359
'If the axis `type` is *log*, then you must take the',
@@ -339,6 +371,7 @@ module.exports = {
339371
values: ['auto', 'top', 'middle', 'bottom'],
340372
dflt: 'auto',
341373
role: 'info',
374+
editType: 'calcIfAutorange',
342375
description: [
343376
'Sets the text box\'s vertical position anchor',
344377
'This anchor binds the `y` position to the *top*, *middle*',
@@ -357,6 +390,7 @@ module.exports = {
357390
valType: 'number',
358391
dflt: 0,
359392
role: 'style',
393+
editType: 'calcIfAutorange',
360394
description: [
361395
'Shifts the position of the whole annotation and arrow up',
362396
'(positive) or down (negative) by this many pixels.'
@@ -367,6 +401,7 @@ module.exports = {
367401
values: [false, 'onoff', 'onout'],
368402
dflt: false,
369403
role: 'style',
404+
editType: 'arraydraw',
370405
description: [
371406
'Makes this annotation respond to clicks on the plot.',
372407
'If you click a data point that exactly matches the `x` and `y`',
@@ -385,6 +420,7 @@ module.exports = {
385420
xclick: {
386421
valType: 'any',
387422
role: 'info',
423+
editType: 'arraydraw',
388424
description: [
389425
'Toggle this annotation when clicking a data point whose `x` value',
390426
'is `xclick` rather than the annotation\'s `x` value.'
@@ -393,6 +429,7 @@ module.exports = {
393429
yclick: {
394430
valType: 'any',
395431
role: 'info',
432+
editType: 'arraydraw',
396433
description: [
397434
'Toggle this annotation when clicking a data point whose `y` value',
398435
'is `yclick` rather than the annotation\'s `y` value.'
@@ -401,6 +438,7 @@ module.exports = {
401438
hovertext: {
402439
valType: 'string',
403440
role: 'info',
441+
editType: 'arraydraw',
404442
description: [
405443
'Sets text to appear when hovering over this annotation.',
406444
'If omitted or blank, no hover label will appear.'
@@ -410,6 +448,7 @@ module.exports = {
410448
bgcolor: {
411449
valType: 'color',
412450
role: 'style',
451+
editType: 'arraydraw',
413452
description: [
414453
'Sets the background color of the hover label.',
415454
'By default uses the annotation\'s `bgcolor` made opaque,',
@@ -419,23 +458,27 @@ module.exports = {
419458
bordercolor: {
420459
valType: 'color',
421460
role: 'style',
461+
editType: 'arraydraw',
422462
description: [
423463
'Sets the border color of the hover label.',
424464
'By default uses either dark grey or white, for maximum',
425465
'contrast with `hoverlabel.bgcolor`.'
426466
].join(' ')
427467
},
428-
font: extendFlat({}, fontAttrs, {
468+
font: fontAttrs({
469+
editType: 'arraydraw',
429470
description: [
430471
'Sets the hover label text font.',
431472
'By default uses the global hover font and size,',
432473
'with color from `hoverlabel.bordercolor`.'
433474
].join(' ')
434-
})
475+
}),
476+
editType: 'arraydraw'
435477
},
436478
captureevents: {
437479
valType: 'boolean',
438480
role: 'info',
481+
editType: 'arraydraw',
439482
description: [
440483
'Determines whether the annotation text box captures mouse move',
441484
'and click events, or allows those events to pass through to data',
@@ -445,11 +488,13 @@ module.exports = {
445488
'you must explicitly enable `captureevents`.'
446489
].join(' ')
447490
},
491+
editType: 'calc',
448492

449493
_deprecated: {
450494
ref: {
451495
valType: 'string',
452496
role: 'info',
497+
editType: 'calc',
453498
description: [
454499
'Obsolete. Set `xref` and `yref` separately instead.'
455500
].join(' ')

‎src/components/annotations3d/attributes.js

Copy file name to clipboardExpand all lines: src/components/annotations3d/attributes.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
'use strict';
1111

1212
var annAtts = require('../annotations/attributes');
13+
var overrideAll = require('../../plot_api/edit_types').overrideAll;
1314

14-
module.exports = {
15+
module.exports = overrideAll({
1516
_isLinkedToArray: 'annotation',
1617

1718
visible: annAtts.visible,
@@ -76,7 +77,7 @@ module.exports = {
7677
standoff: annAtts.standoff,
7778
hovertext: annAtts.hovertext,
7879
hoverlabel: annAtts.hoverlabel,
79-
captureevents: annAtts.captureevents
80+
captureevents: annAtts.captureevents,
8081

8182
// maybes later?
8283
// clicktoshow: annAtts.clicktoshow,
@@ -89,4 +90,4 @@ module.exports = {
8990
// xref: 'x'
9091
// yref: 'y
9192
// zref: 'z'
92-
};
93+
}, 'calc', 'from-root');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.