check if second x axis tick required
This commit is contained in:
parent
ac8952d7ec
commit
ddc2645bef
|
@ -329,7 +329,13 @@ export const drawAxis = ( node, params ) => {
|
|||
.tickValues( ticks )
|
||||
.tickFormat( ( d, i ) => {
|
||||
const monthDate = d instanceof Date ? d : new Date( d );
|
||||
return monthDate.getDate() === 1 || i === 0 ? params.x2Format( monthDate ) : '';
|
||||
let prevMonth = i !== 0 ? params.uniqueDates[ i - 1 ] : params.uniqueDates[ i ];
|
||||
prevMonth = prevMonth instanceof Date ? prevMonth : new Date( prevMonth );
|
||||
return monthDate.getDate() === 1 ||
|
||||
i === 0 ||
|
||||
params.x2Format( monthDate ) !== params.x2Format( prevMonth )
|
||||
? params.x2Format( monthDate )
|
||||
: '';
|
||||
} )
|
||||
)
|
||||
.call( g => g.select( '.domain' ).remove() );
|
||||
|
|
Loading…
Reference in New Issue