Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ef323f

Browse files
committed
mv 'selectedpoints' & 'selectedids' to global trace attrs/defaults
- and coerce if module's `selectPoints` method exists - don't dive into `selectedpoints` array (leave that for calc, later).
1 parent 6903d31 commit 3ef323f

File tree

5 files changed

+34
-72
lines changed

5 files changed

+34
-72
lines changed

src/plots/attributes.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,35 @@ module.exports = {
9494
'DOM elements'
9595
].join(' ')
9696
},
97+
98+
// N.B. these cannot be 'data_array' as they do not have the same length as
99+
// other data arrays and arrayOk attributes in general
100+
//
101+
// TODO maybe add another valType:
102+
// https://github.com/plotly/plotly.js/issues/1894
103+
selectedpoints: {
104+
valType: 'any',
105+
role: 'info',
106+
editType: 'calc',
107+
description: [
108+
'Array containing integer indices of selected points.',
109+
'Has an effect only for traces that support selections.',
110+
'Note that an empty array means an empty selection where the `unselected`',
111+
'are turned on for all points, whereas, any other non-array values means no',
112+
'selection all where the `selected` and `unselected` styles have no effect.'
113+
].join(' ')
114+
},
115+
selectedids: {
116+
valType: 'any',
117+
role: 'info',
118+
editType: 'calc',
119+
description: [
120+
'Array containing `ids` of selected points.',
121+
'Has an effect only for traces that support selections.',
122+
'...'
123+
].join(' ')
124+
},
125+
97126
hoverinfo: {
98127
valType: 'flaglist',
99128
role: 'info',

src/plots/plots.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,11 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
10221022
traceOut.visible = !!traceOut.visible;
10231023
}
10241024

1025+
if(_module && _module.selectPoints) {
1026+
coerce('selectedpoints');
1027+
coerce('selectedids');
1028+
}
1029+
10251030
plots.supplyTransformDefaults(traceIn, traceOut, layout);
10261031
}
10271032

src/traces/scatter/attributes.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,6 @@ module.exports = {
433433
},
434434
editType: 'style'
435435
},
436-
selectedpoints: {
437-
valType: 'any',
438-
role: 'info',
439-
editType: 'calc',
440-
description: 'Array containing integer indices of selected points.',
441-
},
442-
selectedids: {
443-
valType: 'any',
444-
role: 'info',
445-
editType: 'calc',
446-
description: 'Array containing `ids` of selected points.',
447-
},
448436
editType: 'style'
449437
},
450438

src/traces/scatter/defaults.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ var handleLineShapeDefaults = require('./line_shape_defaults');
2121
var handleTextDefaults = require('./text_defaults');
2222
var handleFillColorDefaults = require('./fillcolor_defaults');
2323
var errorBarsSupplyDefaults = require('../../components/errorbars/defaults');
24-
var handleInteractionDefaults = require('./interaction_defaults');
25-
2624

2725
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
2826
function coerce(attr, dflt) {
@@ -41,8 +39,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4139
coerce('hovertext');
4240
coerce('mode', defaultMode);
4341

44-
handleInteractionDefaults(traceIn, traceOut, coerce);
45-
4642
if(subTypes.hasLines(traceOut)) {
4743
handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);
4844
handleLineShapeDefaults(traceIn, traceOut, coerce);

src/traces/scatter/interaction_defaults.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)