diff --git a/frontend/src/lib/components/InsightLegend/InsightLegend.tsx b/frontend/src/lib/components/InsightLegend/InsightLegend.tsx index c311b1d39dc76..41a91f038ad60 100644 --- a/frontend/src/lib/components/InsightLegend/InsightLegend.tsx +++ b/frontend/src/lib/components/InsightLegend/InsightLegend.tsx @@ -3,9 +3,8 @@ import { useActions, useValues } from 'kea' import { insightLogic } from 'scenes/insights/insightLogic' import clsx from 'clsx' import { InsightLegendRow } from './InsightLegendRow' -import { shouldHighlightThisRow, DISPLAY_TYPES_WITHOUT_LEGEND } from './utils' +import { shouldHighlightThisRow } from './utils' import { trendsDataLogic } from 'scenes/trends/trendsDataLogic' -import { ChartDisplayType } from '~/types' export interface InsightLegendProps { readOnly?: boolean @@ -17,9 +16,9 @@ export function InsightLegend({ horizontal, inCardView, readOnly = false }: Insi // TODO: replace isSingleSeries etc. with data exploration variant const { insightProps, highlightedSeries, isSingleSeries, hiddenLegendKeys } = useValues(insightLogic) const { toggleVisibility } = useActions(insightLogic) - const { indexedResults, compare, display, trendsFilter } = useValues(trendsDataLogic(insightProps)) + const { indexedResults, compare, display, trendsFilter, hasLegend } = useValues(trendsDataLogic(insightProps)) - return DISPLAY_TYPES_WITHOUT_LEGEND.includes(display || ('' as ChartDisplayType)) ? ( + return hasLegend ? (
([ hasLegend: [ (s) => [s.isTrends, s.isStickiness, s.display], (isTrends, isStickiness, display) => - (isTrends || isStickiness) && !!display && !displayTypesWithoutLegend.includes(display), + (isTrends || isStickiness) && !!display && !DISPLAY_TYPES_WITHOUT_LEGEND.includes(display), ], hasFormula: [(s) => [s.formula], (formula) => formula !== undefined], diff --git a/frontend/src/scenes/trends/trendsDataLogic.ts b/frontend/src/scenes/trends/trendsDataLogic.ts index f88fa177204b6..85b7f4712e4c8 100644 --- a/frontend/src/scenes/trends/trendsDataLogic.ts +++ b/frontend/src/scenes/trends/trendsDataLogic.ts @@ -25,12 +25,13 @@ export const trendsDataLogic = kea([ 'breakdown', 'shownAs', 'showValueOnSeries', - 'isNonTimeSeriesDisplay', 'trendsFilter', 'lifecycleFilter', 'isTrends', 'isLifecycle', 'isStickiness', + 'isNonTimeSeriesDisplay', + 'hasLegend', ], ], })),