diff --git a/packages/charts/src/chart_types/xy_chart/annotations/utils.ts b/packages/charts/src/chart_types/xy_chart/annotations/utils.ts index 53830862d2..0024dd38c2 100644 --- a/packages/charts/src/chart_types/xy_chart/annotations/utils.ts +++ b/packages/charts/src/chart_types/xy_chart/annotations/utils.ts @@ -118,8 +118,8 @@ export function invertTransformedCursor( export function computeAnnotationDimensions( annotations: AnnotationSpec[], chartRotation: Rotation, - yScales: Map>, - xScale: Scale, + yScales: Map>, + xScale: Scale, axesSpecs: AxisSpec[], isHistogramModeEnabled: boolean, smallMultipleScales: SmallMultipleScales, @@ -145,22 +145,22 @@ export function computeAnnotationDimensions( annotationDimensions.set(id, dimensions); } return annotationDimensions; - } - - const dimensions = computeRectAnnotationDimensions( - annotationSpec, - yScales, - xScale, - axesSpecs, - smallMultipleScales, - chartRotation, - getAxisStyle, - isHistogramModeEnabled, - ); + } else { + const dimensions = computeRectAnnotationDimensions( + annotationSpec, + yScales, + xScale as Scale, + axesSpecs, + smallMultipleScales, + chartRotation, + getAxisStyle, + isHistogramModeEnabled, + ); - if (dimensions) { - annotationDimensions.set(id, dimensions); + if (dimensions) { + annotationDimensions.set(id, dimensions); + } + return annotationDimensions; } - return annotationDimensions; }, new Map()); } diff --git a/packages/charts/src/chart_types/xy_chart/state/selectors/compute_annotations.ts b/packages/charts/src/chart_types/xy_chart/state/selectors/compute_annotations.ts index 6725bd0b66..c534e0bffa 100644 --- a/packages/charts/src/chart_types/xy_chart/state/selectors/compute_annotations.ts +++ b/packages/charts/src/chart_types/xy_chart/state/selectors/compute_annotations.ts @@ -6,10 +6,11 @@ * Side Public License, v 1. */ +import { Scale } from '../../../../scales'; import { createCustomCachedSelector } from '../../../../state/create_selector'; import { getChartThemeSelector } from '../../../../state/selectors/get_chart_theme'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; -import { AnnotationId, AxisId } from '../../../../utils/ids'; +import { AnnotationId, AxisId, GroupId } from '../../../../utils/ids'; import { AnnotationDimensions } from '../../annotations/types'; import { computeAnnotationDimensions } from '../../annotations/utils'; import { computeSeriesGeometriesSelector } from './compute_series_geometries'; @@ -44,7 +45,7 @@ export const computeAnnotationDimensionsSelector = createCustomCachedSelector( return computeAnnotationDimensions( annotationSpecs, settingsSpec.rotation, - yScales, + yScales as Map>, xScale, axesSpecs, isHistogramMode,