Skip to content

Commit

Permalink
fix legend display types
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Jul 14, 2023
1 parent be33ff7 commit 97a474c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions frontend/src/lib/components/InsightLegend/InsightLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ? (
<div
className={clsx('InsightLegendMenu', 'flex overflow-auto border rounded', {
'InsightLegendMenu--horizontal': horizontal,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/insights/insightVizDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
import { insightVizDataNodeKey } from '~/queries/nodes/InsightViz/InsightViz'
import { subscriptions } from 'kea-subscriptions'
import { displayTypesWithoutLegend } from 'lib/components/InsightLegend/utils'
import { DISPLAY_TYPES_WITHOUT_LEGEND } from 'lib/components/InsightLegend/utils'
import { insightDataLogic, queryFromKind } from 'scenes/insights/insightDataLogic'

import { sceneLogic } from 'scenes/sceneLogic'
Expand Down Expand Up @@ -175,7 +175,7 @@ export const insightVizDataLogic = kea<insightVizDataLogicType>([
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],
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/scenes/trends/trendsDataLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export const trendsDataLogic = kea<trendsDataLogicType>([
'breakdown',
'shownAs',
'showValueOnSeries',
'isNonTimeSeriesDisplay',
'trendsFilter',
'lifecycleFilter',
'isTrends',
'isLifecycle',
'isStickiness',
'isNonTimeSeriesDisplay',
'hasLegend',
],
],
})),
Expand Down

0 comments on commit 97a474c

Please sign in to comment.