@@ -571,34 +571,44 @@ axes.calcTicks = function calcTicks(ax) {
571571 if ( ( ax . _tmin < startTick ) !== axrev ) return [ ] ;
572572
573573 // return the full set of tick vals
574- var vals = [ ] ;
574+ var tickVals = [ ] ;
575575 if ( ax . type === 'category' || ax . type === 'multicategory' ) {
576576 endTick = ( axrev ) ? Math . max ( - 0.5 , endTick ) :
577577 Math . min ( ax . _categories . length - 0.5 , endTick ) ;
578578 }
579579
580+ var isDLog = ( ax . type === 'log' ) && ! ( isNumeric ( ax . dtick ) || ax . dtick . charAt ( 0 ) === 'L' ) ;
581+
580582 var xPrevious = null ;
581583 var maxTicks = Math . max ( 1000 , ax . _length || 0 ) ;
582584 for ( var x = ax . _tmin ;
583585 ( axrev ) ? ( x >= endTick ) : ( x <= endTick ) ;
584586 x = axes . tickIncrement ( x , ax . dtick , axrev , ax . calendar ) ) {
585587 // prevent infinite loops - no more than one tick per pixel,
586588 // 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 ;
588590 xPrevious = x ;
589591
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+ } ) ;
591601 }
592602
593603 // If same angle over a full circle, the last tick vals is a duplicate.
594604 // TODO must do something similar for angular date axes.
595605 if ( isAngular ( ax ) && Math . abs ( rng [ 1 ] - rng [ 0 ] ) === 360 ) {
596- vals . pop ( ) ;
606+ tickVals . pop ( ) ;
597607 }
598608
599609 // save the last tick as well as first, so we can
600610 // show the exponent only on the last one
601- ax . _tmax = vals [ vals . length - 1 ] ;
611+ ax . _tmax = ( tickVals [ tickVals . length - 1 ] || { } ) . value ;
602612
603613 // for showing the rest of a date when the main tick label is only the
604614 // latter part: ax._prevDateHead holds what we showed most recently.
@@ -607,8 +617,15 @@ axes.calcTicks = function calcTicks(ax) {
607617 ax . _prevDateHead = '' ;
608618 ax . _inCalcTicks = true ;
609619
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+ }
612629
613630 ax . _inCalcTicks = false ;
614631
@@ -937,7 +954,7 @@ axes.tickFirst = function(ax) {
937954// ax is the axis layout, x is the tick value
938955// hover is a (truthy) flag for whether to show numbers with a bit
939956// more precision for hovertext
940- axes . tickText = function ( ax , x , hover ) {
957+ axes . tickText = function ( ax , x , hover , noSuffixPrefix ) {
941958 var out = tickTextObj ( ax , x ) ;
942959 var arrayMode = ax . tickmode === 'array' ;
943960 var extraPrecision = hover || arrayMode ;
@@ -983,8 +1000,10 @@ axes.tickText = function(ax, x, hover) {
9831000 else formatLinear ( ax , out , hover , extraPrecision , hideexp ) ;
9841001
9851002 // 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+ }
9881007
9891008 // Setup ticks and grid lines boundaries
9901009 // at 1/2 a 'category' to the left/bottom
0 commit comments