@@ -25,6 +25,7 @@ function AxesOptions() {
25
25
this . tickFont = [ 'sans-serif' , 'sans-serif' , 'sans-serif' ] ;
26
26
this . tickSize = [ 12 , 12 , 12 ] ;
27
27
this . tickAngle = [ 0 , 0 , 0 ] ;
28
+ this . tickAlign = [ 'auto' , 'auto' , 'auto' ] ;
28
29
this . tickColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
29
30
this . tickPad = [ 18 , 18 , 18 ] ;
30
31
@@ -33,6 +34,7 @@ function AxesOptions() {
33
34
this . labelFont = [ 'Open Sans' , 'Open Sans' , 'Open Sans' ] ;
34
35
this . labelSize = [ 20 , 20 , 20 ] ;
35
36
this . labelAngle = [ 0 , 0 , 0 ] ;
37
+ this . labelAlign = [ 'auto' , 'auto' , 'auto' ] ;
36
38
this . labelColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
37
39
this . labelPad = [ 30 , 30 , 30 ] ;
38
40
@@ -91,6 +93,18 @@ proto.merge = function(sceneLayout) {
91
93
if ( axes . titlefont . family ) opts . labelFont [ i ] = axes . titlefont . family ;
92
94
if ( axes . titlefont . size ) opts . labelSize [ i ] = axes . titlefont . size ;
93
95
}
96
+ // Title rotation/alignment similar to ticks
97
+ if ( 'titleangle' in axes ) {
98
+ if ( axes . titleangle === 'auto' ) {
99
+ opts . labelAlign [ i ] = 'auto' ;
100
+ opts . labelAngle [ i ] = 0 ;
101
+ } else {
102
+ opts . labelAlign [ i ] = - 1 ;
103
+ opts . labelAngle [ i ] = Math . PI * - axes . labelangle / 180 ;
104
+ }
105
+ }
106
+ if ( axes . titlealign === 'auto' ) opts . labelAlign [ i ] = 'auto' ;
107
+ if ( 'titlealign' in axes ) opts . lableAlign [ i ] = axes . titlealign ;
94
108
95
109
// Lines
96
110
if ( 'showline' in axes ) opts . lineEnable [ i ] = axes . showline ;
@@ -118,10 +132,17 @@ proto.merge = function(sceneLayout) {
118
132
if ( 'tickcolor' in axes ) opts . lineTickColor [ i ] = str2RgbaArray ( axes . tickcolor ) ;
119
133
if ( 'tickwidth' in axes ) opts . lineTickWidth [ i ] = axes . tickwidth ;
120
134
if ( 'tickangle' in axes ) {
121
- opts . tickAngle [ i ] = ( axes . tickangle === 'auto' ) ?
122
- 0 :
123
- Math . PI * - axes . tickangle / 180 ;
135
+ if ( axes . tickangle === 'auto' ) {
136
+ opts . tickAlign [ i ] = 'auto' ;
137
+ opts . tickAngle [ i ] = 0 ;
138
+ } else {
139
+ opts . tickAlign [ i ] = - 1 ;
140
+ opts . tickAngle [ i ] = Math . PI * - axes . tickangle / 180 ;
141
+ }
124
142
}
143
+ if ( axes . tickalign === 'auto' ) opts . tickAlign [ i ] = 'auto' ;
144
+ if ( 'tickalign' in axes ) opts . tickAlign [ i ] = axes . tickalign ;
145
+
125
146
// tick labels
126
147
if ( 'showticklabels' in axes ) opts . tickEnable [ i ] = axes . showticklabels ;
127
148
if ( 'tickfont' in axes ) {
0 commit comments