@@ -18,53 +18,53 @@ var arrayCopy1D = arrtools.copy1D;
1818var AXES_NAMES = [ 'xaxis' , 'yaxis' , 'zaxis' ] ;
1919
2020function AxesOptions ( ) {
21- this . bounds = [ [ - 10 , - 10 , - 10 ] ,
22- [ 10 , 10 , 10 ] ] ;
23-
24- this . ticks = [ [ ] , [ ] , [ ] ] ;
25- this . tickEnable = [ true , true , true ] ;
26- this . tickFont = [ 'sans-serif' , 'sans-serif' , 'sans-serif' ] ;
27- this . tickSize = [ 12 , 12 , 12 ] ;
28- this . tickAngle = [ 0 , 0 , 0 ] ;
29- this . tickColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
30- this . tickPad = [ 18 , 18 , 18 ] ;
31-
32- this . labels = [ 'x' , 'y' , 'z' ] ;
33- this . labelEnable = [ true , true , true ] ;
34- this . labelFont = [ 'Open Sans' , 'Open Sans' , 'Open Sans' ] ;
35- this . labelSize = [ 20 , 20 , 20 ] ;
36- this . labelAngle = [ 0 , 0 , 0 ] ;
37- this . labelColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
38- this . labelPad = [ 30 , 30 , 30 ] ;
39-
40- this . lineEnable = [ true , true , true ] ;
41- this . lineMirror = [ false , false , false ] ;
42- this . lineWidth = [ 1 , 1 , 1 ] ;
43- this . lineColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
21+ this . bounds = [ [ - 10 , - 10 , - 10 ] ,
22+ [ 10 , 10 , 10 ] ] ;
23+
24+ this . ticks = [ [ ] , [ ] , [ ] ] ;
25+ this . tickEnable = [ true , true , true ] ;
26+ this . tickFont = [ 'sans-serif' , 'sans-serif' , 'sans-serif' ] ;
27+ this . tickSize = [ 12 , 12 , 12 ] ;
28+ this . tickAngle = [ 0 , 0 , 0 ] ;
29+ this . tickColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
30+ this . tickPad = [ 18 , 18 , 18 ] ;
31+
32+ this . labels = [ 'x' , 'y' , 'z' ] ;
33+ this . labelEnable = [ true , true , true ] ;
34+ this . labelFont = [ 'Open Sans' , 'Open Sans' , 'Open Sans' ] ;
35+ this . labelSize = [ 20 , 20 , 20 ] ;
36+ this . labelAngle = [ 0 , 0 , 0 ] ;
37+ this . labelColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
38+ this . labelPad = [ 30 , 30 , 30 ] ;
39+
40+ this . lineEnable = [ true , true , true ] ;
41+ this . lineMirror = [ false , false , false ] ;
42+ this . lineWidth = [ 1 , 1 , 1 ] ;
43+ this . lineColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
4444
4545 this . lineTickEnable = [ true , true , true ] ;
4646 this . lineTickMirror = [ false , false , false ] ;
4747 this . lineTickLength = [ 10 , 10 , 10 ] ;
48- this . lineTickWidth = [ 1 , 1 , 1 ] ;
49- this . lineTickColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
48+ this . lineTickWidth = [ 1 , 1 , 1 ] ;
49+ this . lineTickColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
5050
51- this . gridEnable = [ true , true , true ] ;
52- this . gridWidth = [ 1 , 1 , 1 ] ;
53- this . gridColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
51+ this . gridEnable = [ true , true , true ] ;
52+ this . gridWidth = [ 1 , 1 , 1 ] ;
53+ this . gridColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
5454
55- this . zeroEnable = [ true , true , true ] ;
56- this . zeroLineColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
57- this . zeroLineWidth = [ 2 , 2 , 2 ] ;
55+ this . zeroEnable = [ true , true , true ] ;
56+ this . zeroLineColor = [ [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 1 ] ] ;
57+ this . zeroLineWidth = [ 2 , 2 , 2 ] ;
5858
5959 this . backgroundEnable = [ true , true , true ] ;
6060 this . backgroundColor = [ [ 0.8 , 0.8 , 0.8 , 0.5 ] ,
6161 [ 0.8 , 0.8 , 0.8 , 0.5 ] ,
6262 [ 0.8 , 0.8 , 0.8 , 0.5 ] ] ;
6363
6464 // some default values are stored for applying model transforms
65- this . _defaultTickPad = arrayCopy1D ( this . tickPad ) ;
66- this . _defaultLabelPad = arrayCopy1D ( this . labelPad ) ;
67- this . _defaultLineTickLength = arrayCopy1D ( this . lineTickLength ) ;
65+ this . _defaultTickPad = arrayCopy1D ( this . tickPad ) ;
66+ this . _defaultLabelPad = arrayCopy1D ( this . labelPad ) ;
67+ this . _defaultLineTickLength = arrayCopy1D ( this . lineTickLength ) ;
6868}
6969
7070var proto = AxesOptions . prototype ;
@@ -78,27 +78,30 @@ proto.merge = function(sceneLayout) {
7878 opts . labels [ i ] = convertHTML ( axes . title ) ;
7979 if ( 'titlefont' in axes ) {
8080 if ( axes . titlefont . color ) opts . labelColor [ i ] = str2RgbaArray ( axes . titlefont . color ) ;
81- if ( axes . titlefont . family ) opts . labelFont [ i ] = axes . titlefont . family ;
82- if ( axes . titlefont . size ) opts . labelSize [ i ] = axes . titlefont . size ;
81+ if ( axes . titlefont . family ) opts . labelFont [ i ] = axes . titlefont . family ;
82+ if ( axes . titlefont . size ) opts . labelSize [ i ] = axes . titlefont . size ;
8383 }
8484
8585 /////// LINES ////////
8686 if ( 'showline' in axes ) opts . lineEnable [ i ] = axes . showline ;
87- if ( 'linecolor' in axes ) opts . lineColor [ i ] = str2RgbaArray ( axes . linecolor ) ;
88- if ( 'linewidth' in axes ) opts . lineWidth [ i ] = axes . linewidth ;
87+ if ( 'linecolor' in axes ) opts . lineColor [ i ] = str2RgbaArray ( axes . linecolor ) ;
88+ if ( 'linewidth' in axes ) opts . lineWidth [ i ] = axes . linewidth ;
8989
9090 if ( 'showgrid' in axes ) opts . gridEnable [ i ] = axes . showgrid ;
91- if ( 'gridcolor' in axes ) opts . gridColor [ i ] = str2RgbaArray ( axes . gridcolor ) ;
92- if ( 'gridwidth' in axes ) opts . gridWidth [ i ] = axes . gridwidth ;
91+ if ( 'gridcolor' in axes ) opts . gridColor [ i ] = str2RgbaArray ( axes . gridcolor ) ;
92+ if ( 'gridwidth' in axes ) opts . gridWidth [ i ] = axes . gridwidth ;
9393
94- if ( 'zeroline' in axes ) opts . zeroEnable [ i ] = axes . zeroline ;
94+ // Remove zeroline if axis type is log
95+ // otherwise the zeroline is incorrectly drawn at 1 on log axes
96+ if ( axes . type === 'log' ) opts . zeroEnable [ i ] = false ;
97+ else if ( 'zeroline' in axes ) opts . zeroEnable [ i ] = axes . zeroline ;
9598 if ( 'zerolinecolor' in axes ) opts . zeroLineColor [ i ] = str2RgbaArray ( axes . zerolinecolor ) ;
9699 if ( 'zerolinewidth' in axes ) opts . zeroLineWidth [ i ] = axes . zerolinewidth ;
97100
98101 //////// TICKS /////////
99102 /// tick lines
100103 if ( 'ticks' in axes && ! ! axes . ticks ) opts . lineTickEnable [ i ] = true ;
101- else opts . lineTickEnable [ i ] = false ;
104+ else opts . lineTickEnable [ i ] = false ;
102105
103106 if ( 'ticklen' in axes ) {
104107 opts . lineTickLength [ i ] = opts . _defaultLineTickLength [ i ] = axes . ticklen ;
@@ -111,9 +114,9 @@ proto.merge = function(sceneLayout) {
111114 //// tick labels
112115 if ( 'showticklabels' in axes ) opts . tickEnable [ i ] = axes . showticklabels ;
113116 if ( 'tickfont' in axes ) {
114- if ( axes . tickfont . color ) opts . tickColor [ i ] = str2RgbaArray ( axes . tickfont . color ) ;
115- if ( axes . tickfont . family ) opts . tickFont [ i ] = axes . tickfont . family ;
116- if ( axes . tickfont . size ) opts . tickSize [ i ] = axes . tickfont . size ;
117+ if ( axes . tickfont . color ) opts . tickColor [ i ] = str2RgbaArray ( axes . tickfont . color ) ;
118+ if ( axes . tickfont . family ) opts . tickFont [ i ] = axes . tickfont . family ;
119+ if ( axes . tickfont . size ) opts . tickSize [ i ] = axes . tickfont . size ;
117120 }
118121
119122 if ( 'mirror' in axes ) {
@@ -131,8 +134,8 @@ proto.merge = function(sceneLayout) {
131134
132135 ////// grid background
133136 if ( 'showbackground' in axes && axes . showbackground !== false ) {
134- opts . backgroundEnable [ i ] = true ;
135- opts . backgroundColor [ i ] = str2RgbaArray ( axes . backgroundcolor ) ;
137+ opts . backgroundEnable [ i ] = true ;
138+ opts . backgroundColor [ i ] = str2RgbaArray ( axes . backgroundcolor ) ;
136139 } else opts . backgroundEnable [ i ] = false ;
137140 }
138141} ;
0 commit comments