@@ -1539,40 +1539,26 @@ axes.getTickFormat = function(ax) {
1539
1539
if ( ax . tickformatstops && ax . tickformatstops . length > 0 ) {
1540
1540
switch ( ax . type ) {
1541
1541
case 'date' : {
1542
- tickstop = ax . tickformatstops . reduce ( function ( acc , stop ) {
1543
- if ( ! isProperStop ( ax . dtick , stop . dtickrange , convertToMs ) ) {
1544
- return acc ;
1545
- }
1546
- if ( ! acc ) {
1547
- return stop ;
1548
- } else {
1549
- return getRangeWidth ( stop . dtickrange , convertToMs ) > getRangeWidth ( acc . dtickrange , convertToMs ) ? stop : acc ;
1550
- }
1551
- } , null ) ;
1542
+ tickstop = ax . tickformatstops . find ( function ( stop ) {
1543
+ return isProperStop ( ax . dtick , stop . dtickrange , convertToMs )
1544
+ } ) ;
1552
1545
break ;
1553
1546
}
1554
1547
case 'linear' : {
1555
- tickstop = ax . tickformatstops . reduce ( function ( acc , stop ) {
1556
- if ( ! isProperStop ( ax . dtick , stop . dtickrange ) ) {
1557
- return acc ;
1558
- }
1559
- if ( ! acc ) {
1560
- return stop ;
1561
- } else {
1562
- return getRangeWidth ( stop . dtickrange ) > getRangeWidth ( acc . dtickrange ) ? stop : acc ;
1563
- }
1564
- } , null ) ;
1548
+ tickstop = ax . tickformatstops . find ( function ( stop ) {
1549
+ return isProperStop ( ax . dtick , stop . dtickrange , convertToMs )
1550
+ } ) ;
1565
1551
break ;
1566
1552
}
1567
1553
case 'log' : {
1568
- tickstop = ax . tickformatstops . filter ( function ( stop ) {
1554
+ tickstop = ax . tickformatstops . find ( function ( stop ) {
1569
1555
var left = stop . dtickrange [ 0 ] , right = stop . dtickrange [ 1 ] ;
1570
1556
var isLeftDtickNull = left === null ;
1571
1557
var isRightDtickNull = right === null ;
1572
1558
var isDtickInRangeLeft = compareLogTicks ( ax . dtick , left ) >= 0 ;
1573
1559
var isDtickInRangeRight = compareLogTicks ( ax . dtick , right ) <= 0 ;
1574
1560
return ( isLeftDtickNull || isDtickInRangeLeft ) && ( isRightDtickNull || isDtickInRangeRight ) ;
1575
- } ) [ 0 ] ;
1561
+ } ) ;
1576
1562
break ;
1577
1563
}
1578
1564
default :
0 commit comments