@@ -31,13 +31,18 @@ var setConvert = require('./set_convert');
31
31
* noTickson: boolean, this axis doesn't support 'tickson'
32
32
* data: the plot data, used to manage categories
33
33
* bgColor: the plot background color, to calculate default gridline colors
34
+ * calendar:
35
+ * splomStash:
36
+ * visibleDflt: boolean
37
+ * reverseDflt: boolean
38
+ * automargin: boolean
34
39
*/
35
40
module . exports = function handleAxisDefaults ( containerIn , containerOut , coerce , options , layoutOut ) {
36
41
var letter = options . letter ;
37
42
var font = options . font || { } ;
38
43
var splomStash = options . splomStash || { } ;
39
44
40
- var visible = coerce ( 'visible' , ! options . cheateronly ) ;
45
+ var visible = coerce ( 'visible' , ! options . visibleDflt ) ;
41
46
42
47
var axType = containerOut . type ;
43
48
@@ -48,7 +53,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
48
53
49
54
setConvert ( containerOut , layoutOut ) ;
50
55
51
- var autoRange = coerce ( 'autorange' , ! containerOut . isValidRange ( containerIn . range ) ) ;
56
+ var autorangeDflt = ! containerOut . isValidRange ( containerIn . range ) ;
57
+ if ( autorangeDflt && options . reverseDflt ) autorangeDflt = 'reversed' ;
58
+ var autoRange = coerce ( 'autorange' , autorangeDflt ) ;
52
59
if ( autoRange && ( axType === 'linear' || axType === '-' ) ) coerce ( 'rangemode' ) ;
53
60
54
61
coerce ( 'range' ) ;
@@ -58,8 +65,6 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
58
65
59
66
if ( axType !== 'category' && ! options . noHover ) coerce ( 'hoverformat' ) ;
60
67
61
- if ( ! visible ) return containerOut ;
62
-
63
68
var dfltColor = coerce ( 'color' ) ;
64
69
// if axis.color was provided, use it for fonts too; otherwise,
65
70
// inherit from global font color in case that was provided.
@@ -69,6 +74,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
69
74
// try to get default title from splom trace, fallback to graph-wide value
70
75
var dfltTitle = splomStash . label || layoutOut . _dfltTitle [ letter ] ;
71
76
77
+ handleTickLabelDefaults ( containerIn , containerOut , coerce , axType , options , { pass : 1 } ) ;
78
+ if ( ! visible ) return containerOut ;
79
+
72
80
coerce ( 'title.text' , dfltTitle ) ;
73
81
Lib . coerceFont ( coerce , 'title.font' , {
74
82
family : font . family ,
@@ -77,7 +85,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
77
85
} ) ;
78
86
79
87
handleTickValueDefaults ( containerIn , containerOut , coerce , axType ) ;
80
- handleTickLabelDefaults ( containerIn , containerOut , coerce , axType , options ) ;
88
+ handleTickLabelDefaults ( containerIn , containerOut , coerce , axType , options , { pass : 2 } ) ;
81
89
handleTickMarkDefaults ( containerIn , containerOut , coerce , options ) ;
82
90
handleLineGridDefaults ( containerIn , containerOut , coerce , {
83
91
dfltColor : dfltColor ,
0 commit comments