import { Scale } from '@chart-parts/interfaces' ; import { format } from 'd3-format' ; import { timeFormat } from 'd3-time-format' ; import { AxisContext } from '../../interfaces' ; function isTimeScale ( scale ) { return scale . __scaletype__ === 'utc' || scale . __scaletype__ === 'time' ; } ignore export function getLabelFormatter ( context ) { const scale = context . scale ; const { labelFormat } = context . axis ; if ( ! labelFormat ) { return ( t ) => `${ t }` ; } return isTimeScale ( scale ) ? timeFormat ( labelFormat ) : format ( labelFormat ) ; }