Skip to content

Commit

Permalink
fix(insights): added title for tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
sanskar-soni-9 committed Aug 8, 2024
1 parent 940131a commit eb94455
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function InsightTooltip({
date,
timezone = 'UTC',
seriesData = [],
title: _title,
altTitle,
altRightTitle,
renderSeries,
Expand All @@ -99,13 +100,9 @@ export function InsightTooltip({

const { formatPropertyValueForDisplay } = useValues(propertyDefinitionsModel)

const title: ReactNode | null =
const title: ReactNode =
getTooltipTitle(seriesData, altTitle, date) ||
(date
? `${getFormattedDate(date, seriesData?.[0]?.filter?.interval)} (${
timezone ? shortTimeZone(timezone) : 'UTC'
})`
: null)
`${getFormattedDate(_title)} ${timezone ? shortTimeZone(timezone) : 'UTC'}`
const rightTitle: ReactNode | null = getTooltipTitle(seriesData, altRightTitle, date) || null

if (itemizeEntitiesAsColumns) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface InsightTooltipProps extends Omit<TooltipConfig, 'renderSeries'
breakdownFilter?: BreakdownFilter | undefined | null
groupTypeLabel?: string
timezone?: string | null
title: string
}

export const COL_CUTOFF = 4
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/insights/views/LineGraph/LineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ export function LineGraph_({
tooltipRoot.render(
<InsightTooltip
date={dataset?.days?.[tooltip.dataPoints?.[0]?.dataIndex]}
title={tooltip.title[0]}
timezone={timezone}
seriesData={seriesData}
breakdownFilter={breakdownFilter}
Expand Down

0 comments on commit eb94455

Please sign in to comment.