@@ -571,34 +571,44 @@ axes.calcTicks = function calcTicks(ax) {
571
571
if ( ( ax . _tmin < startTick ) !== axrev ) return [ ] ;
572
572
573
573
// return the full set of tick vals
574
- var vals = [ ] ;
574
+ var tickVals = [ ] ;
575
575
if ( ax . type === 'category' || ax . type === 'multicategory' ) {
576
576
endTick = ( axrev ) ? Math . max ( - 0.5 , endTick ) :
577
577
Math . min ( ax . _categories . length - 0.5 , endTick ) ;
578
578
}
579
579
580
+ var isDLog = ( ax . type === 'log' ) && ! ( isNumeric ( ax . dtick ) || ax . dtick . charAt ( 0 ) === 'L' ) ;
581
+
580
582
var xPrevious = null ;
581
583
var maxTicks = Math . max ( 1000 , ax . _length || 0 ) ;
582
584
for ( var x = ax . _tmin ;
583
585
( axrev ) ? ( x >= endTick ) : ( x <= endTick ) ;
584
586
x = axes . tickIncrement ( x , ax . dtick , axrev , ax . calendar ) ) {
585
587
// prevent infinite loops - no more than one tick per pixel,
586
588
// and make sure each value is different from the previous
587
- if ( vals . length > maxTicks || x === xPrevious ) break ;
589
+ if ( tickVals . length > maxTicks || x === xPrevious ) break ;
588
590
xPrevious = x ;
589
591
590
- vals . push ( x ) ;
592
+ var minor = false ;
593
+ if ( isDLog && ( x !== ( x | 0 ) ) ) {
594
+ minor = true ;
595
+ }
596
+
597
+ tickVals . push ( {
598
+ minor : minor ,
599
+ value : x
600
+ } ) ;
591
601
}
592
602
593
603
// If same angle over a full circle, the last tick vals is a duplicate.
594
604
// TODO must do something similar for angular date axes.
595
605
if ( isAngular ( ax ) && Math . abs ( rng [ 1 ] - rng [ 0 ] ) === 360 ) {
596
- vals . pop ( ) ;
606
+ tickVals . pop ( ) ;
597
607
}
598
608
599
609
// save the last tick as well as first, so we can
600
610
// show the exponent only on the last one
601
- ax . _tmax = vals [ vals . length - 1 ] ;
611
+ ax . _tmax = ( tickVals [ tickVals . length - 1 ] || { } ) . value ;
602
612
603
613
// for showing the rest of a date when the main tick label is only the
604
614
// latter part: ax._prevDateHead holds what we showed most recently.
@@ -607,8 +617,15 @@ axes.calcTicks = function calcTicks(ax) {
607
617
ax . _prevDateHead = '' ;
608
618
ax . _inCalcTicks = true ;
609
619
610
- var ticksOut = new Array ( vals . length ) ;
611
- for ( var i = 0 ; i < vals . length ; i ++ ) ticksOut [ i ] = axes . tickText ( ax , vals [ i ] ) ;
620
+ var ticksOut = new Array ( tickVals . length ) ;
621
+ for ( var i = 0 ; i < tickVals . length ; i ++ ) {
622
+ ticksOut [ i ] = axes . tickText (
623
+ ax ,
624
+ tickVals [ i ] . value ,
625
+ false , // hover
626
+ tickVals [ i ] . minor // noSuffixPrefix
627
+ ) ;
628
+ }
612
629
613
630
ax . _inCalcTicks = false ;
614
631
@@ -937,7 +954,7 @@ axes.tickFirst = function(ax) {
937
954
// ax is the axis layout, x is the tick value
938
955
// hover is a (truthy) flag for whether to show numbers with a bit
939
956
// more precision for hovertext
940
- axes . tickText = function ( ax , x , hover ) {
957
+ axes . tickText = function ( ax , x , hover , noSuffixPrefix ) {
941
958
var out = tickTextObj ( ax , x ) ;
942
959
var arrayMode = ax . tickmode === 'array' ;
943
960
var extraPrecision = hover || arrayMode ;
@@ -983,8 +1000,10 @@ axes.tickText = function(ax, x, hover) {
983
1000
else formatLinear ( ax , out , hover , extraPrecision , hideexp ) ;
984
1001
985
1002
// add prefix and suffix
986
- if ( ax . tickprefix && ! isHidden ( ax . showtickprefix ) ) out . text = ax . tickprefix + out . text ;
987
- if ( ax . ticksuffix && ! isHidden ( ax . showticksuffix ) ) out . text += ax . ticksuffix ;
1003
+ if ( ! noSuffixPrefix ) {
1004
+ if ( ax . tickprefix && ! isHidden ( ax . showtickprefix ) ) out . text = ax . tickprefix + out . text ;
1005
+ if ( ax . ticksuffix && ! isHidden ( ax . showticksuffix ) ) out . text += ax . ticksuffix ;
1006
+ }
988
1007
989
1008
// Setup ticks and grid lines boundaries
990
1009
// at 1/2 a 'category' to the left/bottom
0 commit comments