Skip to content

Commit e8dbf55

Browse files
committed
improve jsDoc for restyle/relayout/update
1 parent 01967d8 commit e8dbf55

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/plot_api/plot_api.js

+21-19
Original file line numberDiff line numberDiff line change
@@ -1115,21 +1115,23 @@ Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
11151115
* Can be called two ways.
11161116
*
11171117
* Signature 1:
1118-
* @param {string id or DOM element} gd
1118+
* @param {String | HTMLDivElement} gd
11191119
* the id or DOM element of the graph container div
1120-
* @param {string} astr
1120+
* @param {String} astr
11211121
* attribute string (like `'marker.symbol'`) to update
1122-
* @param {any} val
1122+
* @param {*} val
11231123
* value to give this attribute
1124-
* @param {number or array} traces (optional)
1124+
* @param {Number[] | Number} [traces]
11251125
* integer or array of integers for the traces to alter (all if omitted)
11261126
*
11271127
* Signature 2:
1128-
* @param {string id or DOM element} gd (as in signature 1)
1129-
* @param {object} aobj
1128+
* @param {String | HTMLDivElement} gd
1129+
* (as in signature 1)
1130+
* @param {Object} aobj
11301131
* attribute object `{astr1: val1, astr2: val2 ...}`
11311132
* allows setting multiple attributes simultaneously
1132-
* @param {number or array} traces (optional, as in signature 1)
1133+
* @param {Number[] | Number} [traces]
1134+
* (as in signature 1)
11331135
*
11341136
* `val` (or `val1`, `val2` ... in the object form) can be an array,
11351137
* to apply different values to each trace.
@@ -1142,11 +1144,11 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {
11421144
helpers.clearPromiseQueue(gd);
11431145

11441146
var aobj = {};
1145-
11461147
if(typeof astr === 'string') aobj[astr] = val;
11471148
else if(Lib.isPlainObject(astr)) {
1149+
// the 3-arg form
11481150
aobj = astr;
1149-
if(traces === undefined) traces = val; // the 3-arg form
1151+
if(traces === undefined) traces = val;
11501152
}
11511153
else {
11521154
Lib.warn('Restyle fail.', astr, val, traces);
@@ -1632,17 +1634,17 @@ function _restyle(gd, aobj, traces) {
16321634
* Can be called two ways:
16331635
*
16341636
* Signature 1:
1635-
* @param {string id or dom element} gd
1637+
* @param {String | HTMLDivElement} gd
16361638
* the id or dom element of the graph container div
1637-
* @param {string} astr
1639+
* @param {String} astr
16381640
* attribute string (like `'xaxis.range[0]'`) to update
1639-
* @param {any} val
1641+
* @param {*} val
16401642
* value to give this attribute
16411643
*
16421644
* Signature 2:
1643-
* @param {string id or DOM element} gd (as in signature 1)
1644-
* the id or DOM element of the graph container div
1645-
* @param {object} aobj
1645+
* @param {String | HTMLDivElement} gd
1646+
* (as in signature 1)
1647+
* @param {Object} aobj
16461648
* attribute object `{astr1: val1, astr2: val2 ...}`
16471649
* allows setting multiple attributes simultaneously
16481650
*/
@@ -2021,15 +2023,15 @@ function _relayout(gd, aobj) {
20212023
/**
20222024
* update: update trace and layout attributes of an existing plot
20232025
*
2024-
* @param {string id or DOM element} gd
2026+
* @param {String | HTMLDivElement} gd
20252027
* the id or DOM element of the graph container div
2026-
* @param {object} traceUpdate
2028+
* @param {Object} traceUpdate
20272029
* attribute object `{astr1: val1, astr2: val2 ...}`
20282030
* corresponding to updates in the plot's traces
2029-
* @param {object} layoutUpdate
2031+
* @param {Object} layoutUpdate
20302032
* attribute object `{astr1: val1, astr2: val2 ...}`
20312033
* corresponding to updates in the plot's layout
2032-
* @param {number or array} traces (optional)
2034+
* @param {Number[] | Number} [traces]
20332035
* integer or array of integers for the traces to alter (all if omitted)
20342036
*
20352037
*/

0 commit comments

Comments
 (0)