@@ -24,7 +24,11 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks,
24
24
// contour plots only want the centers
25
25
if ( isContour || isGL2D ) arrayOut = Array . from ( arrayIn ) . slice ( 0 , numbricks ) ;
26
26
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
+ }
28
32
} else if ( ax . type === 'log' ) {
29
33
arrayOut = [ Math . pow ( arrayIn [ 0 ] , 1.5 ) / Math . pow ( arrayIn [ 1 ] , 0.5 ) ] ;
30
34
@@ -47,11 +51,21 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks,
47
51
48
52
if ( len < numbricks ) {
49
53
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 ] ;
51
64
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
+ }
55
69
}
56
70
}
57
71
} else {
0 commit comments