diff --git a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.test.tsx b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.test.tsx index 6af1c89fd1991..e9fa4aae02d7c 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.test.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.test.tsx @@ -7,11 +7,11 @@ import type { HistogramItem } from '../../../../../common/correlations/types'; -import { replaceHistogramDotsWithBars } from '.'; +import { replaceHistogramZerosWithMinimumDomainValue } from '.'; describe('TransactionDistributionChart', () => { - describe('replaceHistogramDotsWithBars', () => { - it('does the thing', () => { + describe('replaceHistogramZerosWithMinimumDomainValue', () => { + it('replaces zeroes', () => { const mockHistogram = [ { doc_count: 10 }, { doc_count: 10 }, @@ -25,15 +25,17 @@ describe('TransactionDistributionChart', () => { { doc_count: 10 }, ] as HistogramItem[]; - expect(replaceHistogramDotsWithBars(mockHistogram)).toEqual([ + expect( + replaceHistogramZerosWithMinimumDomainValue(mockHistogram) + ).toEqual([ { doc_count: 10 }, { doc_count: 10 }, - { doc_count: 0.0001 }, - { doc_count: 0.0001 }, - { doc_count: 0.0001 }, + { doc_count: 0.5 }, + { doc_count: 0.5 }, + { doc_count: 0.5 }, { doc_count: 10 }, { doc_count: 10 }, - { doc_count: 0.0001 }, + { doc_count: 0.5 }, { doc_count: 10 }, { doc_count: 10 }, ]); diff --git a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx index 712ba0e8952d3..9fdbe77a6e7fc 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx @@ -88,7 +88,7 @@ const getAnnotationsStyle = (color = 'gray'): LineAnnotationStyle => ({ // This is just to visually fix the line, for tooltips, that number will be again rounded down to 0. const Y_AXIS_MIN_DOMAIN = 0.5; -export const replaceHistogramZeroesWithMinimumDomainValue = ( +export const replaceHistogramZerosWithMinimumDomainValue = ( histogramItems: HistogramItem[] ) => histogramItems.reduce((histogramItem, _, i) => { @@ -275,7 +275,7 @@ export function DurationDistributionChart({ id={d.id} xScaleType={ScaleType.Log} yScaleType={ScaleType.Log} - data={replaceHistogramZeroesWithMinimumDomainValue(d.histogram)} + data={replaceHistogramZerosWithMinimumDomainValue(d.histogram)} curve={CurveType.CURVE_STEP_AFTER} xAccessor="key" yAccessors={['doc_count']}