From f4ddeb7cafcd532c816a1f3e8981d307ba4005e6 Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Thu, 8 Apr 2021 15:41:11 +0300 Subject: [PATCH] Update index.tsx --- .../editor/components/options/metrics_axes/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx b/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx index 11b3a98658e64..d25845f02e7a7 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx +++ b/src/plugins/vis_type_xy/public/editor/components/options/metrics_axes/index.tsx @@ -283,11 +283,10 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps) { const updatedSeries = metrics.map((agg) => { const params = stateParams.seriesParams.find((param) => param.data.id === agg.id); const label = agg.makeLabel(); - let series: SeriesParam; // update labels for existing params or create new one if (params) { - series = { + return { ...params, data: { ...params.data, @@ -295,15 +294,14 @@ function MetricsAxisOptions(props: ValidationVisOptionsProps) { }, }; } else { - series = makeSerie( + const series = makeSerie( agg.id, label, firstValueAxesId, stateParams.seriesParams[stateParams.seriesParams.length - 1] ); + return series; } - - return series; }); setValue('seriesParams', updatedSeries);