@@ -27,9 +27,12 @@ module.exports = function calc(trace, vals, containerStr, cLetter) {
27
27
inputContainer = trace . _input ;
28
28
}
29
29
30
- var auto = container [ cLetter + 'auto' ] ,
31
- min = container [ cLetter + 'min' ] ,
32
- max = container [ cLetter + 'max' ] ,
30
+ var autoAttr = cLetter + 'auto' ,
31
+ minAttr = cLetter + 'min' ,
32
+ maxAttr = cLetter + 'max' ,
33
+ auto = container [ autoAttr ] ,
34
+ min = container [ minAttr ] ,
35
+ max = container [ maxAttr ] ,
33
36
scl = container . colorscale ;
34
37
35
38
if ( auto !== false || min === undefined ) {
@@ -45,11 +48,21 @@ module.exports = function calc(trace, vals, containerStr, cLetter) {
45
48
max += 0.5 ;
46
49
}
47
50
48
- container [ cLetter + 'min' ] = min ;
49
- container [ cLetter + 'max' ] = max ;
51
+ container [ minAttr ] = min ;
52
+ container [ maxAttr ] = max ;
50
53
51
- inputContainer [ cLetter + 'min' ] = min ;
52
- inputContainer [ cLetter + 'max' ] = max ;
54
+ inputContainer [ minAttr ] = min ;
55
+ inputContainer [ maxAttr ] = max ;
56
+
57
+ /*
58
+ * If auto was explicitly false but min or max was missing,
59
+ * we filled in the missing piece here but later the trace does
60
+ * not look auto.
61
+ * Otherwise make sure the trace still looks auto as far as later
62
+ * changes are concerned.
63
+ */
64
+ inputContainer [ autoAttr ] = ( auto !== false ||
65
+ ( min === undefined && max === undefined ) ) ;
53
66
54
67
if ( container . autocolorscale ) {
55
68
if ( min * max < 0 ) scl = scales . RdBu ;
0 commit comments