@@ -578,9 +578,31 @@ export default function transformProps(
578578 : String ;
579579 const xAxisFormatter =
580580 xAxisDataType === GenericDataType . Temporal
581- ? getXAxisFormatter ( xAxisTimeFormat )
581+ ? getXAxisFormatter ( xAxisTimeFormat , timeGrainSqla )
582582 : String ;
583583
584+ const showMaxLabel = xAxisType === AxisType . Time && xAxisLabelRotation === 0 ;
585+ const deduplicatedFormatter = showMaxLabel
586+ ? ( ( ) => {
587+ let lastLabel : string | undefined ;
588+ const wrapper = ( value : number | string ) => {
589+ const label =
590+ typeof xAxisFormatter === 'function'
591+ ? ( xAxisFormatter as Function ) ( value )
592+ : String ( value ) ;
593+ if ( label === lastLabel ) {
594+ return '' ;
595+ }
596+ lastLabel = label ;
597+ return label ;
598+ } ;
599+ if ( typeof xAxisFormatter === 'function' && 'id' in xAxisFormatter ) {
600+ ( wrapper as any ) . id = ( xAxisFormatter as any ) . id ;
601+ }
602+ return wrapper ;
603+ } ) ( )
604+ : xAxisFormatter ;
605+
584606 const addYAxisTitleOffset =
585607 ! ! ( yAxisTitle || yAxisTitleSecondary ) &&
586608 convertInteger ( yAxisTitleMargin ) !== 0 ;
@@ -658,9 +680,14 @@ export default function transformProps(
658680 nameGap : convertInteger ( xAxisTitleMargin ) ,
659681 nameLocation : 'middle' ,
660682 axisLabel : {
661- formatter : xAxisFormatter ,
683+ hideOverlap : ! ( xAxisType === AxisType . Time && xAxisLabelRotation !== 0 ) ,
684+ formatter : deduplicatedFormatter ,
662685 rotate : xAxisLabelRotation ,
663686 interval : xAxisLabelInterval ,
687+ ...( showMaxLabel && {
688+ showMaxLabel : true ,
689+ alignMaxLabel : 'right' ,
690+ } ) ,
664691 } ,
665692 minorTick : { show : minorTicks } ,
666693 minInterval :
0 commit comments