From 9f3093b4b9e3d18573a04f0f36c44eaef312e33c Mon Sep 17 00:00:00 2001 From: Mike Haggerty Date: Tue, 3 Sep 2024 14:40:39 -0400 Subject: [PATCH] fix: custom name for horizontal bar chart appears twice (#24729) --- .../scenes/insights/views/LineGraph/LineGraph.tsx | 2 +- .../src/scenes/trends/viz/ActionsHorizontalBar.tsx | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx index 3334e3958017c..c7451e76c2c0f 100644 --- a/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx +++ b/frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx @@ -749,7 +749,7 @@ export function LineGraph_({ d.compareLabels?.[i], ] } else if (d.breakdownLabels?.[i]) { - labelDescriptors = [d.breakdownLabels[i], d.compareLabels?.[i]] + labelDescriptors = [d.actions?.[i]?.name, d.breakdownLabels[i], d.compareLabels?.[i]] } else if (d.labels?.[i]) { labelDescriptors = [d.labels[i], d.compareLabels?.[i]] } else { diff --git a/frontend/src/scenes/trends/viz/ActionsHorizontalBar.tsx b/frontend/src/scenes/trends/viz/ActionsHorizontalBar.tsx index 2b26b5f36d8ed..0fbdecb949d35 100644 --- a/frontend/src/scenes/trends/viz/ActionsHorizontalBar.tsx +++ b/frontend/src/scenes/trends/viz/ActionsHorizontalBar.tsx @@ -48,22 +48,12 @@ export function ActionsHorizontalBar({ showPersonsModal = true }: ChartParams): personsValues: _data.map((item) => item.persons), breakdownValues: _data.map((item) => item.breakdown_value), breakdownLabels: _data.map((item) => { - const itemLabel = item.action - ? item.action.custom_name ?? item.action.name ?? item.action.id - : item.label - - if (!item.breakdown_value) { - return itemLabel - } - - const breakdownLabel = formatBreakdownLabel( + return formatBreakdownLabel( item.breakdown_value, breakdownFilter, cohorts, formatPropertyValueForDisplay ) - - return `${itemLabel} - ${breakdownLabel}` }), compareLabels: _data.map((item) => item.compare_label), backgroundColor: colorList,