@@ -1261,7 +1261,7 @@ Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
1261
1261
* If the array is too short, it will wrap around (useful for
1262
1262
* style files that want to specify cyclical default values).
1263
1263
*/
1264
- Plotly . restyle = function restyle ( gd , astr , val , traces ) {
1264
+ Plotly . restyle = function restyle ( gd , astr , val , _traces ) {
1265
1265
gd = helpers . getGraphDiv ( gd ) ;
1266
1266
helpers . clearPromiseQueue ( gd ) ;
1267
1267
@@ -1270,15 +1270,17 @@ Plotly.restyle = function restyle(gd, astr, val, traces) {
1270
1270
else if ( Lib . isPlainObject ( astr ) ) {
1271
1271
// the 3-arg form
1272
1272
aobj = Lib . extendFlat ( { } , astr ) ;
1273
- if ( traces === undefined ) traces = val ;
1273
+ if ( _traces === undefined ) _traces = val ;
1274
1274
}
1275
1275
else {
1276
- Lib . warn ( 'Restyle fail.' , astr , val , traces ) ;
1276
+ Lib . warn ( 'Restyle fail.' , astr , val , _traces ) ;
1277
1277
return Promise . reject ( ) ;
1278
1278
}
1279
1279
1280
1280
if ( Object . keys ( aobj ) . length ) gd . changed = true ;
1281
1281
1282
+ var traces = helpers . coerceTraceIndices ( gd , _traces ) ;
1283
+
1282
1284
var specs = _restyle ( gd , aobj , traces ) ,
1283
1285
flags = specs . flags ;
1284
1286
@@ -1323,14 +1325,12 @@ function undefinedToNull(val) {
1323
1325
return val ;
1324
1326
}
1325
1327
1326
- function _restyle ( gd , aobj , _traces ) {
1328
+ function _restyle ( gd , aobj , traces ) {
1327
1329
var fullLayout = gd . _fullLayout ,
1328
1330
fullData = gd . _fullData ,
1329
1331
data = gd . data ,
1330
1332
i ;
1331
1333
1332
- var traces = helpers . coerceTraceIndices ( gd , _traces ) ;
1333
-
1334
1334
// initialize flags
1335
1335
var flags = editTypes . traceFlags ( ) ;
1336
1336
@@ -2071,7 +2071,7 @@ function _relayout(gd, aobj) {
2071
2071
* integer or array of integers for the traces to alter (all if omitted)
2072
2072
*
2073
2073
*/
2074
- Plotly . update = function update ( gd , traceUpdate , layoutUpdate , traces ) {
2074
+ Plotly . update = function update ( gd , traceUpdate , layoutUpdate , _traces ) {
2075
2075
gd = helpers . getGraphDiv ( gd ) ;
2076
2076
helpers . clearPromiseQueue ( gd ) ;
2077
2077
@@ -2085,6 +2085,8 @@ Plotly.update = function update(gd, traceUpdate, layoutUpdate, traces) {
2085
2085
if ( Object . keys ( traceUpdate ) . length ) gd . changed = true ;
2086
2086
if ( Object . keys ( layoutUpdate ) . length ) gd . changed = true ;
2087
2087
2088
+ var traces = helpers . coerceTraceIndices ( gd , _traces ) ;
2089
+
2088
2090
var restyleSpecs = _restyle ( gd , Lib . extendFlat ( { } , traceUpdate ) , traces ) ,
2089
2091
restyleFlags = restyleSpecs . flags ;
2090
2092
@@ -2152,10 +2154,6 @@ Plotly.update = function update(gd, traceUpdate, layoutUpdate, traces) {
2152
2154
// so we auto-set them again
2153
2155
var axLetters = [ 'x' , 'y' , 'z' ] ;
2154
2156
function clearAxisTypes ( gd , traces , layoutUpdate ) {
2155
- if ( typeof traces === 'number' ) traces = [ traces ] ;
2156
- else if ( ! Array . isArray ( traces ) || ! traces . length ) {
2157
- traces = ( gd . _fullData ) . map ( function ( d , i ) { return i ; } ) ;
2158
- }
2159
2157
for ( var i = 0 ; i < traces . length ; i ++ ) {
2160
2158
var trace = gd . _fullData [ i ] ;
2161
2159
for ( var j = 0 ; j < 3 ; j ++ ) {
0 commit comments