PostHog / PostHog/posthog

feat(insights): show total row in tooltip for stacked area/bar charts

Open
#52,302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/insights team/product-analytics
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Feature request

Is your feature request related to a problem?

When viewing a stacked area chart with breakdowns, the hover tooltip shows each series value individually but does not show the total for that data point. Users who are tracking performance across multiple resources need to see both the breakdown and the overall number at a glance, without creating a separate chart.

For example, hovering over a day might show:

  • AB: 26
  • CD: 2
  • EF: 1
  • GH: 1

But there's no "Total: 30" row, which means users have to mentally sum the values or build a separate insight.

Describe the solution you'd like

Add an optional "Total" row to the tooltip when hovering over stacked area or bar charts with breakdowns. This could be:

  1. A total row at the bottom of the tooltip (simpler, likely the best first step): Sum all visible series values for the hovered date and display it as a final row in the tooltip table.
  2. Totals shown directly on the chart (e.g. under each x-axis date label): A more ambitious option that would make daily totals visible without hovering.

Option 1 could be the default for stacked charts or toggled via a chart option. The infrastructure is partially there already: InsightTooltip renders via LemonTable which supports a footer prop (currently unused), and the percent stack view already computes the total to derive percentages.

Describe alternatives you've considered

  • Creating a separate trends insight without breakdowns to see totals. This works but requires maintaining two charts for what is conceptually one question.
  • Using the data table view instead of the chart. This shows totals but loses the visual context of the area chart.

Additional context

Relevant code:

Customer feedback: "I would love to have an option to either see totals under the day or on hover above the breakdown. I'm measuring performance of different resources, and how they're split and it's also nice to see overall numbers at a glance. For my use case, I know the breakdown numbers won't overlap so I'm sure that the totals will be correct."

Debug info

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in frontend/src/scenes/insights/InsightTooltip/InsightTooltip.tsx and inspect how LemonTable and its footer are used. Then read the total calculation around LineGraph.tsx ~L863 and trace the data passed to stacked area and bar tooltips. Done means the tooltip presents the requested total behavior for stacked charts without breaking the existing breakdown rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
analytics, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.