@@ -381,6 +381,7 @@ function axisTextKy(
381381 dx : anchor === "left" ? + dx - tickSize - tickPadding + + insetLeft : + dx + + tickSize + + tickPadding - insetRight
382382 } ,
383383 function ( scale , ticks , channels ) {
384+ if ( scale . type === "linear-integer" && tickFormat === undefined ) tickFormat = "d" ;
384385 if ( fontVariant === undefined ) this . fontVariant = inferFontVariant ( scale ) ;
385386 if ( text === undefined ) channels . text = inferTextChannel ( scale , ticks , tickFormat ) ;
386387 }
@@ -428,6 +429,7 @@ function axisTextKx(
428429 dy : anchor === "bottom" ? + dy + + tickSize + + tickPadding - insetBottom : + dy - tickSize - tickPadding + + insetTop
429430 } ,
430431 function ( scale , ticks , channels ) {
432+ if ( scale . type === "linear-integer" && tickFormat === undefined ) tickFormat = "d" ;
431433 if ( fontVariant === undefined ) this . fontVariant = inferFontVariant ( scale ) ;
432434 if ( text === undefined ) channels . text = inferTextChannel ( scale , ticks , tickFormat ) ;
433435 }
@@ -505,12 +507,17 @@ function axisMark(mark, k, ariaLabel, data, options, initialize) {
505507 if ( ! scale ) throw new Error ( `missing scale: ${ k } ` ) ;
506508 let { ticks, tickSpacing, interval} = options ;
507509 if ( isTemporalScale ( scale ) && typeof ticks === "string" ) ( interval = ticks ) , ( ticks = undefined ) ;
510+
511+ const tickFunction =
512+ scale . type === "linear-integer"
513+ ? ( ticks ) => scale . ticks ( ticks ) . filter ( ( d ) => d === Math . floor ( d ) )
514+ : scale . ticks ;
508515 if ( data == null ) {
509516 if ( isIterable ( ticks ) ) {
510517 data = arrayify ( ticks ) ;
511518 } else if ( scale . ticks ) {
512519 if ( ticks !== undefined ) {
513- data = scale . ticks ( ticks ) ;
520+ data = tickFunction ( ticks ) ;
514521 } else {
515522 interval = maybeInterval ( interval === undefined ? scale . interval : interval , scale . type ) ;
516523 if ( interval !== undefined ) {
@@ -523,7 +530,7 @@ function axisMark(mark, k, ariaLabel, data, options, initialize) {
523530 } else {
524531 const [ min , max ] = extent ( scale . range ( ) ) ;
525532 ticks = ( max - min ) / ( tickSpacing === undefined ? ( k === "x" ? 80 : 35 ) : tickSpacing ) ;
526- data = scale . ticks ( ticks ) ;
533+ data = tickFunction ( ticks ) ;
527534 }
528535 }
529536 } else {
0 commit comments