File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 10
10
'use strict' ;
11
11
12
12
var d3 = require ( 'd3' ) ;
13
+ var tc = require ( 'tinycolor2' ) ;
13
14
14
15
var Plotly = require ( '../../plotly' ) ;
15
16
var Plots = require ( '../../plots/plots' ) ;
@@ -356,13 +357,22 @@ module.exports = function draw(gd, id) {
356
357
if ( i !== filllevels . length - 1 ) {
357
358
z [ 1 ] += ( z [ 1 ] > z [ 0 ] ) ? 1 : - 1 ;
358
359
}
360
+
361
+
362
+ // Tinycolor can't handle exponents and
363
+ // at this scale, removing it makes no difference.
364
+ var colorString = fillcolormap ( d ) . replace ( 'e-' , '' ) ,
365
+ opaqueColor = tc ( colorString ) . toHexString ( ) ;
366
+
367
+ // Colorbar cannot currently support opacities so we
368
+ // use an opaque fill even when alpha channels present
359
369
d3 . select ( this ) . attr ( {
360
370
x : xLeft ,
361
371
width : Math . max ( thickPx , 2 ) ,
362
372
y : d3 . min ( z ) ,
363
- height : Math . max ( d3 . max ( z ) - d3 . min ( z ) , 2 )
364
- } )
365
- . style ( 'fill' , fillcolormap ( d ) ) ;
373
+ height : Math . max ( d3 . max ( z ) - d3 . min ( z ) , 2 ) ,
374
+ fill : opaqueColor
375
+ } ) ;
366
376
} ) ;
367
377
368
378
var lines = container . select ( '.cblines' )
You can’t perform that action at this time.
0 commit comments