@@ -24,7 +24,11 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks,
2424 // contour plots only want the centers
2525 if ( isContour || isGL2D ) arrayOut = Array . from ( arrayIn ) . slice ( 0 , numbricks ) ;
2626 else if ( numbricks === 1 ) {
27- arrayOut = [ arrayIn [ 0 ] - 0.5 , arrayIn [ 0 ] + 0.5 ] ;
27+ if ( ax . type === 'log' ) {
28+ arrayOut = [ 0.5 * arrayIn [ 0 ] , 2 * arrayIn [ 0 ] ] ;
29+ } else {
30+ arrayOut = [ arrayIn [ 0 ] - 0.5 , arrayIn [ 0 ] + 0.5 ] ;
31+ }
2832 } else if ( ax . type === 'log' ) {
2933 arrayOut = [ Math . pow ( arrayIn [ 0 ] , 1.5 ) / Math . pow ( arrayIn [ 1 ] , 0.5 ) ] ;
3034
@@ -47,11 +51,21 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks,
4751
4852 if ( len < numbricks ) {
4953 var lastPt = arrayOut [ arrayOut . length - 1 ] ;
50- var delta = lastPt - arrayOut [ arrayOut . length - 2 ] ;
54+ var delta ; // either multiplicative delta (log axis type) or arithmetic delta (all other axis types)
55+ if ( ax . type === 'log' ) {
56+ delta = lastPt / arrayOut [ arrayOut . length - 2 ] ;
57+
58+ for ( i = len ; i < numbricks ; i ++ ) {
59+ lastPt *= delta ;
60+ arrayOut . push ( lastPt ) ;
61+ }
62+ } else {
63+ delta = lastPt - arrayOut [ arrayOut . length - 2 ] ;
5164
52- for ( i = len ; i < numbricks ; i ++ ) {
53- lastPt += delta ;
54- arrayOut . push ( lastPt ) ;
65+ for ( i = len ; i < numbricks ; i ++ ) {
66+ lastPt += delta ;
67+ arrayOut . push ( lastPt ) ;
68+ }
5569 }
5670 }
5771 } else {
0 commit comments