Skip to content

[Due for payment 2026-07-28] Top Employees by Spend chart height should adapt to the number of results #95434

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: v9.4.28-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @shawnborton
Slack conversation (hyperlinked to channel name): #Concierge AI

Action Performed:

Prerequisite: Workspace with two employees and each have approved expenses

  1. Navigate to Concierge chat
  2. Ask a question "Top Employees by Spend"
  3. Observe the chart height and spacing in Concierge response

Expected Result:

The chart height adjusts dynamically based on the number of employees displayed.
The spacing between rows remains consistent with charts containing more employees.
The labels on the left axis are positioned closer to the chart for better readability.
The chart maintains a balanced appearance regardless of the number of results.

Actual Result:

The chart uses a fixed height even when only two employees are displayed.
Excessive empty space makes the chart feel oversized.
The employee names on the left axis are farther from the bars than necessary.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Image Image Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @luacmartins

Activity

  1. added
    InternalRequires API changes or must be handled by Expensify staff
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 6, 2026
  2. MelvinBot commented on Jul 6, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: The chart's height is a fixed value baked into the HTML that the backend (Concierge) generates, not something App computes from the number of employees. App's VictoryChartRenderer reads the height straight off the incoming <victorychart> HTML attribute at parseStyles.ts:16 and renders at that height. The only dynamic adjustment App makes is a width‑based uniform scale (computeChartScale.ts:9) that shrinks the whole chart to fit the container width while preserving aspect ratio — it never adapts height to the number of bars. So with only 2 employees, the backend's constant height is rendered unchanged, leaving the excess empty space and the far‑apart axis labels shown in the screenshots.

    Where the fix belongs: This is an internal/backend fix — the App repo is not the source of the height value. The service that authors the Concierge "Top Employees by Spend" chart HTML needs to emit a height (and padding/domain) proportional to the number of rows, rather than a fixed value. This matches the issue's existing Internal label. An internal engineer with access to the backend that generates these charts should own the change; there is no code change to make in Expensify/App for this.

    Investigation details & evidence

    Data flow (all confirmed in App):

    1. Backend/Concierge emits report‑action HTML containing <victorychart height="…" width="…">…</victorychart> (App never generates these tags — they appear only in the renderer/parser directory and the one renderer registration in HTMLRenderers/index.ts).
    2. parseStyles.ts:16 reads tnode.attributes.height → nodeStyles.height (verbatim, no computation involving data/categories).
    3. VictoryChartContainerResponsive.tsx uses that value as designHeight and computes a scale from width only.
    4. computeChartScale.ts:9: Math.min(availableWidth / designWidth, 1) — horizontal fit, capped at 1. Final container height = designHeight × scale.

    Alternative considered (frontend override): App could be changed to derive height from the parsed category count (processedResult.categories.length is available to the renderer) and override the backend value. However, that would fight the backend's intended width/height aspect‑ratio contract and duplicate sizing logic that the chart‑authoring service already owns — so the backend is the correct place to fix the root cause. There is currently no per‑category height logic anywhere in the App renderer.

    Confidence: High. Two independent code investigations agree: the height is backend‑supplied via the HTML attribute, and App only scales uniformly by width. Optional confirmation would be to pull the raw report‑action HTML for an affected message and verify a constant height= value regardless of row count.

    Related issues (not duplicates): Expensify/App#94613 — "Top categories donut chart labels overlap" is a separate Concierge/Insights chart‑layout bug worth tracking alongside this one.


    Next Steps: This requires a backend change by an internal engineer (keeping the Internal label). Reply with @MelvinBot <your feedback> to refine this analysis.

  3. 18 remaining items

  4. situchan commented on Jul 30, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: new feature

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/666507

    Regression Test Proposal

    Test:

    1. Use a workspace with two employees who each have approved expenses
    2. Open Concierge chat and ask "Top Employees by Spend"
    3. Confirm the chart height matches the two rows with consistent spacing between them
    4. Repeat with five employees and confirm the chart still uses the full reference height without clipping
    5. Ask a question that returns a vertical bar chart (for example monthly spend) and confirm its height is unchanged

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-f2be-a5a6-7c2f-684dae8f00f4
  5. mallenexpensify commented on Jul 30, 2026

    @mallenexpensify
    Contributor

    @luacmartins 👀 above to confirm that the PRs warrant $250/each. Thx

    ^ Test case created. Thx

  6. melvin-bot commented on Aug 4, 2026

    @melvin-bot

    @mallenexpensify Eep! 4 days overdue now. Issues have feelings too...

  7. mallenexpensify commented on Aug 5, 2026

    @mallenexpensify
    Contributor

    @luacmartins 👀 above plzz

  8. luacmartins commented on Aug 6, 2026

    @luacmartins
    Contributor

    Sorry, I was OOO for the past couple of weeks. Yes, those look correct.

  9. mallenexpensify commented on Aug 7, 2026

    @mallenexpensify
    Contributor

    @situchan paid, summary updated above. Thx. By default, reviewing multiple PRs doesn't necessarily raise the job amount. Will document something about this before too long

  10. added and removed on Aug 11, 2026
  11. laurenreidexpensify commented on Aug 24, 2026

    @laurenreidexpensify
    Contributor

    $500 approved @situchan New Expensify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2InternalRequires API changes or must be handled by Expensify staffai

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions