App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-10-21] [Insights polish] [R1] Draw `Spend over time` as a bar when there's only one point to plot

Open JmillsExpensify opened this issue 1 month ago • 11 comments

Background

Spend over time is a line chart, which means it needs at least two points to draw a line. With the Custom day Date option, there's only one point, so the graph shows a lone dot with no line, no area fill, and a y-axis scaled around a single value. Previous period adds a second lone dot for the day before, which is just as hard to read.

Accordingly, this issue draws Spend over time as a vertical bar whenever there's only one point to plot.

Product and design details

When the vertical bar is used

  • The rule is based on the number of points, not on the Date option, so whenever Spend over time has exactly one point to plot, we draw a vertical bar. That covers Custom day and any range with expenses in only one period.
  • The moment there are two or more points, the graph is a line chart as today.

The bar

  • The bar uses the same vertical bar styling as the ranking charts in https://github.com/Expensify/App/issues/102814: rounded corners and the 400-level swatch.
  • I believe we're using a max width of 320px to avoid getting very wide bars
  • The x-axis label names the period, e.g. Dec 3. The y-axis scales from zero, so the bar's height reads as an amount.
  • The tooltip and hover target follow https://github.com/Expensify/App/issues/102814's bar chart rules: the target is the full-height rectangle covering the bar, and the tooltip is unchanged.
  • Clicking the bar behaves the same as clicking a point on the line chart.

With Compare

  • Previous period: a bar pair, current period in the 400-level swatch and the prior period in the 200-level swatch, using https://github.com/Expensify/App/issues/102814's pair styling. For Custom day, the prior period is the day before, as defined in R2.
  • Average: a horizontal line across the bar at the average value, labeled the same way as the line chart's Average line.

In-progress period

  • When the single point is the period that contains today, e.g. Custom day set to today, the bar follows https://github.com/Expensify/App/issues/103089's in-progress treatment.
  • The tooltip's so far label is unchanged.
Issue OwnerCurrent Issue Owner: @mallenexpensify

JmillsExpensify avatar Oct 08 '26 10:10 JmillsExpensify

When the single point is the period that contains today, e.g. Custom day set to today, the bar follows https://github.com/Expensify/App/issues/103089 in-progress treatment.

is the bar supposed to look different for in-progress period? we only updated the line to be dashed in that other issue. @dannymcclain

mhawryluk avatar Oct 09 '26 10:10 mhawryluk

is the bar supposed to look different for in-progress period? we only updated the line to be dashed in that other issue.

Yeah I think if we want it to look different for an in-progress period we'll need to come up with a new style for the bar.

I can work on some ideas, but I think for now we might want to continue ahead without an in-progress bar style for now.

dannymcclain avatar Oct 09 '26 13:10 dannymcclain

okie, thanks!

mhawryluk avatar Oct 09 '26 13:10 mhawryluk

@cristipaval / @luacmartins @mhawryluk / @OlGierd03

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.8-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/103579

melvin-bot[bot] avatar Oct 14 '26 12:10 melvin-bot[bot]

Assigned my self since i was C+ of this PR

daledah avatar Oct 19 '26 03:10 daledah

BugZero Checklist:

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

    Link to the comment on the PR: N/A

  • [x] [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:

  • [x] [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.

  • [x] [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/694129

Regression Test Proposal

Precondition:

Test:

  1. Enable the insightsPage beta.
  2. Open Insights.
  3. Set date and group-by so that there's a single data point.
  4. Verify the line chart turns into a bar chart.
  5. Set date and group-by so that there's more than one data point.
  6. Verify Spend over time is again a line chart.

Do we agree 👍 or 👎

Zapier Logs Run ID: 00040eee-7111-a367-31c4-a81769380d44

daledah avatar Oct 19 '26 03:10 daledah

Waiting for the regression period to end. Thanks for the testing steps!

JmillsExpensify avatar Oct 19 '26 07:10 JmillsExpensify

Triggered auto assignment to @mallenexpensify (Awaiting Payment)

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

Payment Summary

Resolving PRs:

  • https://github.com/Expensify/App/pull/103579

  • Contributor: @mhawryluk does not require payment (Contractor)

  • Contributor: @OlGierd03 does not require payment (Contractor)

  • Reviewer: @daledah owed $175 via NewDot

BugZero Checklist (@mallenexpensify)

  • [ ] I have confirmed assignees, roles, and Upwork contracts look correct
  • [ ] I have paid out Upwork contracts / manual NewDot requests
  • [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

Payment Summary

Contributor+: @daledah due $250 via NewDot

Part of insights project

mallenexpensify avatar Oct 21 '26 19:10 mallenexpensify

Approved $250 to @daledah

quinthar avatar Nov 15 '26 00:11 quinthar