@@ -54,17 +54,33 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
54
54
var axTemplate = containerOut . _template || { } ;
55
55
var axType = containerOut . type || axTemplate . type || '-' ;
56
56
57
+ var ticklabelmode ;
57
58
if ( axType === 'date' ) {
58
59
var handleCalendarDefaults = Registry . getComponentMethod ( 'calendars' , 'handleDefaults' ) ;
59
60
handleCalendarDefaults ( containerIn , containerOut , 'calendar' , options . calendar ) ;
60
61
61
62
if ( ! options . noTicklabelmode ) {
62
- coerce ( 'ticklabelmode' ) ;
63
+ ticklabelmode = coerce ( 'ticklabelmode' ) ;
63
64
}
64
65
}
65
66
66
67
if ( ! options . noTicklabelposition || axType === 'multicategory' ) {
67
- coerce ( 'ticklabelposition' ) ;
68
+ Lib . coerce ( containerIn , containerOut , {
69
+ ticklabelposition : {
70
+ valType : 'enumerated' ,
71
+ dflt : 'outside' ,
72
+ values : ticklabelmode === 'period' ? [ 'outside' , 'inside' ] :
73
+ letter === 'x' ? [
74
+ 'outside' , 'inside' ,
75
+ 'outside left' , 'inside left' ,
76
+ 'outside right' , 'inside right'
77
+ ] : [
78
+ 'outside' , 'inside' ,
79
+ 'outside top' , 'inside top' ,
80
+ 'outside bottom' , 'inside bottom'
81
+ ]
82
+ }
83
+ } , 'ticklabelposition' ) ;
68
84
}
69
85
70
86
setConvert ( containerOut , layoutOut ) ;
@@ -122,38 +138,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
122
138
) {
123
139
var ticksonDflt ;
124
140
if ( isMultiCategory ) ticksonDflt = 'boundaries' ;
125
- coerce ( 'tickson' , ticksonDflt ) ;
126
- }
127
-
128
- // adjust ticklabelposition to in respect to axis orientation & in-between modes
129
- if ( containerOut . ticklabelposition ) {
130
- if ( letter === 'x' ) {
131
- containerOut . ticklabelposition =
132
- containerOut . ticklabelposition
133
- . replace ( ' top' , '' )
134
- . replace ( ' bottom' , '' ) ;
135
- } else if ( letter === 'y' ) {
136
- containerOut . ticklabelposition =
137
- containerOut . ticklabelposition
138
- . replace ( ' left' , '' )
139
- . replace ( ' right' , '' ) ;
140
- }
141
-
142
- if (
143
- containerOut . tickson === 'boundaries' ||
144
- containerOut . ticklabelmode === 'period'
145
- ) {
146
- if ( letter === 'x' ) {
147
- containerOut . ticklabelposition =
148
- containerOut . ticklabelposition
149
- . replace ( ' left' , '' )
150
- . replace ( ' right' , '' ) ;
151
- } else if ( letter === 'y' ) {
152
- containerOut . ticklabelposition =
153
- containerOut . ticklabelposition
154
- . replace ( ' top' , '' )
155
- . replace ( ' bottom' , '' ) ;
156
- }
141
+ var tickson = coerce ( 'tickson' , ticksonDflt ) ;
142
+ if ( tickson === 'boundaries' ) {
143
+ delete containerOut . ticklabelposition ;
157
144
}
158
145
}
159
146
0 commit comments