import { DatatableRow } from '../../../../expressions/public' ; import { BucketColumns } from '../../common/types' ; export const getDistinctSeries = ( rows , buckets ) => { const parentBucketId = buckets [ 0 ] . id ; const parentSeries = [ ] ; const allSeries = [ ] ; buckets . forEach ( ( { id } ) => { if ( ! id ) return ; rows . forEach ( ( row ) => { const name = row [ id ] ; if ( ! allSeries . includes ( name ) ) { allSeries . push ( name ) ; } if ( id === parentBucketId && ! parentSeries . includes ( row [ parentBucketId ] ) ) { parentSeries . push ( row [ parentBucketId ] ) ; } } ) ; } ) ; return { allSeries , parentSeries , } ; } ;