File tree 2 files changed +48
-2
lines changed
2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -318,11 +318,11 @@ exports.cleanData = function(data) {
318
318
}
319
319
320
320
// scl->scale, reversescl->reversescale
321
- if ( 'scl' in trace ) {
321
+ if ( 'scl' in trace && ! ( 'colorscale' in trace ) ) {
322
322
trace . colorscale = trace . scl ;
323
323
delete trace . scl ;
324
324
}
325
- if ( 'reversescl' in trace ) {
325
+ if ( 'reversescl' in trace && ! ( 'reversescale' in trace ) ) {
326
326
trace . reversescale = trace . reversescl ;
327
327
delete trace . reversescl ;
328
328
}
Original file line number Diff line number Diff line change @@ -2254,6 +2254,52 @@ describe('Test plot api', function() {
2254
2254
2255
2255
afterEach ( destroyGraphDiv ) ;
2256
2256
2257
+ it ( 'should rename \'scl\' to \'colorscale\' when colorscale is not defined' , function ( ) {
2258
+ var data = [ {
2259
+ type : 'heatmap' ,
2260
+ scl : 'Blues'
2261
+ } ] ;
2262
+
2263
+ Plotly . plot ( gd , data ) ;
2264
+ expect ( gd . data [ 0 ] . colorscale ) . toBe ( 'Blues' ) ;
2265
+ expect ( gd . data [ 0 ] . scl ) . toBe ( undefined ) ;
2266
+ } ) ;
2267
+
2268
+ it ( 'should not delete rename \'scl\' to \'colorscale\' when colorscale is defined ' , function ( ) {
2269
+ var data = [ {
2270
+ type : 'heatmap' ,
2271
+ colorscale : 'Greens' ,
2272
+ scl : 'Reds'
2273
+ } ] ;
2274
+
2275
+ Plotly . plot ( gd , data ) ;
2276
+ expect ( gd . data [ 0 ] . colorscale ) . toBe ( 'Greens' ) ;
2277
+ expect ( gd . data [ 0 ] . scl ) . not . toBe ( undefined ) ;
2278
+ } ) ;
2279
+
2280
+ it ( 'should rename \'reversescl\' to \'reversescale\' when colorscale is not defined' , function ( ) {
2281
+ var data = [ {
2282
+ type : 'heatmap' ,
2283
+ reversescl : true
2284
+ } ] ;
2285
+
2286
+ Plotly . plot ( gd , data ) ;
2287
+ expect ( gd . data [ 0 ] . reversescale ) . toBe ( true ) ;
2288
+ expect ( gd . data [ 0 ] . reversescl ) . toBe ( undefined ) ;
2289
+ } ) ;
2290
+
2291
+ it ( 'should not delete & rename \'reversescl\' to \'reversescale\' when colorscale is defined' , function ( ) {
2292
+ var data = [ {
2293
+ type : 'heatmap' ,
2294
+ reversescale : true ,
2295
+ reversescl : false
2296
+ } ] ;
2297
+
2298
+ Plotly . plot ( gd , data ) ;
2299
+ expect ( gd . data [ 0 ] . reversescale ) . toBe ( true ) ;
2300
+ expect ( gd . data [ 0 ] . reversescl ) . not . toBe ( undefined ) ;
2301
+ } ) ;
2302
+
2257
2303
it ( 'should rename \'YIGnBu\' colorscales YlGnBu (2dMap case)' , function ( ) {
2258
2304
var data = [ {
2259
2305
type : 'heatmap' ,
You can’t perform that action at this time.
0 commit comments