Skip to content

Commit 129ad6c

Browse files
committed
make 'ids' and 'customdata' base trace attributes
- making them valid for all trace types
1 parent b831cbc commit 129ad6c

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/plots/attributes.js

+16
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ module.exports = {
6969
role: 'info',
7070
dflt: ''
7171
},
72+
ids: {
73+
valType: 'data_array',
74+
description: [
75+
'Assigns id labels to each datum.',
76+
'These ids for object constancy of data points during animation.'
77+
].join(' ')
78+
},
79+
customdata: {
80+
valType: 'data_array',
81+
description: [
82+
'Assigns extra data each datum.',
83+
'This may be useful when listening to hover, click and selection events.',
84+
'Note that, *scatter* traces also appends customdata items in the markers',
85+
'DOM elements'
86+
].join(' ')
87+
},
7288
hoverinfo: {
7389
valType: 'flaglist',
7490
role: 'info',

src/plots/plots.js

+3
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,9 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
865865
}
866866

867867
if(visible) {
868+
coerce('customdata');
869+
coerce('ids');
870+
868871
var _module = plots.getModule(traceOut);
869872
traceOut._module = _module;
870873

src/traces/scatter/attributes.js

-8
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ module.exports = {
5757
'where `y0` is the starting coordinate and `dy` the step.'
5858
].join(' ')
5959
},
60-
customdata: {
61-
valType: 'data_array',
62-
description: 'Assigns extra data to each scatter point DOM element'
63-
},
6460
dy: {
6561
valType: 'number',
6662
dflt: 1,
@@ -70,10 +66,6 @@ module.exports = {
7066
'See `y0` for more info.'
7167
].join(' ')
7268
},
73-
ids: {
74-
valType: 'data_array',
75-
description: 'A list of keys for object constancy of data points during animation'
76-
},
7769
text: {
7870
valType: 'string',
7971
role: 'info',

src/traces/scatter/defaults.js

-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3636
return;
3737
}
3838

39-
coerce('customdata');
4039
coerce('text');
4140
coerce('hovertext');
4241
coerce('mode', defaultMode);
43-
coerce('ids');
4442

4543
if(subTypes.hasLines(traceOut)) {
4644
handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce);

0 commit comments

Comments
 (0)