@ -108,6 +108,11 @@ c3_axis_internal_fn.isVertical = function () {
c3 _axis _internal _fn . tspanData = function ( d , i , scale ) {
c3 _axis _internal _fn . tspanData = function ( d , i , scale ) {
var internal = this ;
var internal = this ;
var splitted = internal . params . tickMultiline ? internal . splitTickText ( d , scale ) : [ ] . concat ( internal . textFormatted ( d ) ) ;
var splitted = internal . params . tickMultiline ? internal . splitTickText ( d , scale ) : [ ] . concat ( internal . textFormatted ( d ) ) ;
if ( internal . params . tickMultiline && internal . params . tickMultilineMax > 0 ) {
splitted = internal . ellipsify ( splitted , internal . params . tickMultilineMax ) ;
}
return splitted . map ( function ( s ) {
return splitted . map ( function ( s ) {
return { index : i , splitted : s , length : splitted . length } ;
return { index : i , splitted : s , length : splitted . length } ;
} ) ;
} ) ;
@ -147,6 +152,27 @@ c3_axis_internal_fn.splitTickText = function (d, scale) {
return split ( splitted , tickText + "" ) ;
return split ( splitted , tickText + "" ) ;
} ;
} ;
c3 _axis _internal _fn . ellipsify = function ( splitted , max ) {
if ( splitted . length <= max ) {
return splitted ;
}
var ellipsified = splitted . slice ( 0 , max ) ;
var remaining = 3 ;
for ( var i = max - 1 ; i >= 0 ; i -- ) {
var available = ellipsified [ i ] . length ;
ellipsified [ i ] = ellipsified [ i ] . substr ( 0 , available - remaining ) . padEnd ( available , '.' ) ;
remaining -= available ;
if ( remaining <= 0 ) {
break ;
}
}
return ellipsified ;
} ;
c3 _axis _internal _fn . updateTickLength = function ( ) {
c3 _axis _internal _fn . updateTickLength = function ( ) {
var internal = this ;
var internal = this ;
internal . tickLength = Math . max ( internal . innerTickSize , 0 ) + internal . tickPadding ;
internal . tickLength = Math . max ( internal . innerTickSize , 0 ) + internal . tickPadding ;
@ -421,6 +447,7 @@ c3_axis_fn.getXAxis = function getXAxis(scale, orient, tickFormat, tickValues, w
isCategory : $$ . isCategorized ( ) ,
isCategory : $$ . isCategorized ( ) ,
withOuterTick : withOuterTick ,
withOuterTick : withOuterTick ,
tickMultiline : config . axis _x _tick _multiline ,
tickMultiline : config . axis _x _tick _multiline ,
tickMultilineMax : config . axis _x _tick _multiline ? Number ( config . axis _x _tick _multilineMax ) : 0 ,
tickWidth : config . axis _x _tick _width ,
tickWidth : config . axis _x _tick _width ,
tickTextRotate : withoutRotateTickText ? 0 : config . axis _x _tick _rotate ,
tickTextRotate : withoutRotateTickText ? 0 : config . axis _x _tick _rotate ,
withoutTransition : withoutTransition ,
withoutTransition : withoutTransition ,