import { AccessorFn } from '@elastic/charts' ; import { getColumnByAccessor } from './accessor' ; import { DatatableColumn } from '../../../../expressions/public' ; import type { FieldFormatsStart } from '../../../../field_formats/public' ; import { ExpressionValueVisDimension } from '../../../../visualizations/common' ; export const getSplitDimensionAccessor = ( fieldFormats , columns ) => ( splitDimension ) : AccessorFn => { const formatter = fieldFormats . deserialize ( splitDimension . format ) ; const splitChartColumn = getColumnByAccessor ( splitDimension . accessor , columns ) ; const accessor = splitChartColumn . id ; const fn = ( d ) => { const v = d [ accessor ] ; if ( v === undefined ) { return ; } const f = formatter . convert ( v ) ; return f ; } ; return fn ; } ;