fix compareStrings issue
This commit is contained in:
parent
54ffd1bd0a
commit
e6a609ae7a
|
@ -402,18 +402,14 @@ export const drawAxis = ( node, params ) => {
|
||||||
d3AxisBottom( xScale )
|
d3AxisBottom( xScale )
|
||||||
.tickValues( ticks )
|
.tickValues( ticks )
|
||||||
.tickFormat( ( d, i ) => {
|
.tickFormat( ( d, i ) => {
|
||||||
let monthDate = d instanceof Date ? d : new Date( d );
|
const monthDate = d instanceof Date ? d : new Date( d );
|
||||||
let prevMonth = i !== 0 ? ticks[ i - 1 ] : ticks[ i ];
|
let prevMonth = i !== 0 ? ticks[ i - 1 ] : ticks[ i ];
|
||||||
prevMonth = prevMonth instanceof Date ? prevMonth : new Date( prevMonth );
|
prevMonth = prevMonth instanceof Date ? prevMonth : new Date( prevMonth );
|
||||||
monthDate =
|
return i === 0
|
||||||
i !== 0
|
? params.x2Format( monthDate )
|
||||||
? compareStrings(
|
: compareStrings( params.x2Format( prevMonth ), params.x2Format( monthDate ) ).join(
|
||||||
params.x2Format( prevMonth ),
|
' '
|
||||||
params.x2Format( monthDate ),
|
);
|
||||||
params
|
|
||||||
).join( ' ' )
|
|
||||||
: params.x2Format( monthDate );
|
|
||||||
return i === 0 || monthDate !== params.x2Format( prevMonth ) ? monthDate : '';
|
|
||||||
} )
|
} )
|
||||||
)
|
)
|
||||||
.call( g => g.select( '.domain' ).remove() );
|
.call( g => g.select( '.domain' ).remove() );
|
||||||
|
|
Loading…
Reference in New Issue