File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ module.exports = function makeColorMap(trace) {
29
29
30
30
var si , i ;
31
31
32
- if ( contours . coloring === 'heatmap' ) {
33
- var zmin0 = cOpts . min ;
34
- var zmax0 = cOpts . max ;
32
+ var zmin0 = cOpts . min ;
33
+ var zmax0 = cOpts . max ;
35
34
35
+ if ( contours . coloring === 'heatmap' ) {
36
36
for ( i = 0 ; i < len ; i ++ ) {
37
37
si = scl [ i ] ;
38
38
domain [ i ] = si [ 0 ] * ( zmax0 - zmin0 ) + zmin0 ;
@@ -65,6 +65,18 @@ module.exports = function makeColorMap(trace) {
65
65
domain [ i ] = ( si [ 0 ] * ( nc + extra - 1 ) - ( extra / 2 ) ) * cs + start ;
66
66
range [ i ] = si [ 1 ] ;
67
67
}
68
+
69
+ // Ensure zmin and zmax are included in the colorscale
70
+
71
+ if ( domain [ 0 ] > zmin0 ) {
72
+ domain . unshift ( zmin0 ) ;
73
+ range . unshift ( range [ 0 ] ) ;
74
+ }
75
+
76
+ if ( domain [ domain . length - 1 ] < zmax0 ) {
77
+ domain . push ( zmax0 ) ;
78
+ range . push ( range [ range . length - 1 ] ) ;
79
+ }
68
80
}
69
81
70
82
return Colorscale . makeColorScaleFunc (
You can’t perform that action at this time.
0 commit comments