import * as _ from 'lodash' ; import * as setCustomFormatter from './setCustomFormatter' ; export const process = ( chart , config ) => { const cAxis = _ . cloneDeep ( config . axis ) ; const isArr = _ . isArray ( cAxis ) ; if ( _ . isNil ( cAxis ) || cAxis === false || ( isArr && cAxis . length === 0 ) ) { return chart . axis ( false ) ; } if ( cAxis === true ) { return chart . axis ( true ) ; } const arrAxis = isArr ? cAxis : [ cAxis ] ; for ( const res of arrAxis ) { if ( res . label ) { res . label = setCustomFormatter . supportD3Formatter ( res . label ) ; } if ( res . dataKey ) { if ( res . show === false ) { chart . axis ( res . dataKey , false ) ; } else { const options = _ . omit ( res , [ 'show' , 'dataKey' ] ) ; chart . axis ( res . dataKey , options ) ; } } else { chart . axis ( res ) ; } } return chart ; } ;