Skip to content

[No QA][Insights][R1][App] Render the chart inline table - #100807

Merged
cristipaval merged 29 commits into
Expensify:mainfrom
software-mansion-labs:@OlGierd03/Chart-Inline-Table
Sep 25, 2026
Merged

cristipaval merged 29 commits into
Expensify:mainfrom
software-mansion-labs:@OlGierd03/Chart-Inline-Table

Conversation

@OlGierd03

@OlGierd03 OlGierd03 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Every bar and pie chart on the Insights dashboard now renders the chart inline table below it. The line chart across the top of the page stays as it was. The Spend page charts are unchanged.

SearchBarChart, SearchLineChart and SearchPieChart stopped preparing their own data. Mapping moved up into SearchChartView, which builds the series once through the new buildChartSeries and exposes the same prepared rows through the new renderDetails prop. SearchChartDataRow pairs each point with the GroupedItem it came from, so the chart and the table cannot disagree about values or ordering.

PieChartContent gained shouldShowLegend, which SearchChartView turns off whenever renderDetails is supplied. The share comes from the backend as percentOfTotal.

The Insights page is gated behind the insightsPage beta and the table ships with it.

Note

getSliceColorsByDataIndex lives in buildChartSeries.ts rather than next to processDataIntoSlices in Charts/utils, because importing from Charts/utils pulls @shopify/react-native-skia eagerly into the main bundle and breaks the charts.

Fixed Issues

$ #100657

Tests

Prerequisite: enable insightsPage in Account > Troubleshoot > Beta overrides, on an account with a few expenses across different merchants, categories and submitters.

Table rows
  1. Click the Insights tab in the navigation bar.
  2. Verify Spend over time at the top renders the chart alone, with no table.
  3. In Top categories, verify the table renders below the donut, one row per category, in the same order as the slices, each row showing the name over its expense count on the left and the amount over its share of spend on the right.
  4. Verify each row's color dot matches that category's slice, that the old slice legend under the donut is gone and that the center total is still there.
  5. Verify a round share reads (30% - not 30.0%) and a precise one keeps its decimal (40.1%).
  6. In Top merchants, verify no dots are drawn and the row order matches the bars.
  7. In Top spenders, verify each row is preceded by the member's avatar.
  8. Verify the expense count is pluralized correctly.
  9. Verify that the table correctly limits the results to the 10 largest groups, but the percentage of the total is calculated based on all user data.
  10. Verify that the pie chart does not display slices corresponding to a share of total spend of less than 0.1%.
Loading, layout and regressions
  1. Throttle the network, clear the cache and open Insights.
  2. Verify a skeleton stands in for each table with the same row geometry, showing an avatar placeholder only in Top spenders.
  3. On a wide layout, verify the cards stack in two columns without a gap under a shorter card. Resize to a narrow layout and verify they stack in one column and each row keeps its two-column shape without wrapping; repeat in dark theme.
  4. Pick an account or period with no expenses and verify each card shows the usual empty state with no table.
  5. Go to Spend, switch Display > View to Bar or Pie, and verify the chart renders without a table, as on main.
  6. Go to Home and verify the Insights widget still renders the chart alone.

Offline tests

The table adds no requests of its own and renders from the snapshot the chart already reads.

  1. While online, open Insights so the chart snapshots are cached.
  2. Go offline, reload, and open Insights again.
  3. Verify every chart and its table still render, with the same values.

QA Steps

NoQA

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

MacOS: Chrome / Safari
Screen.Recording.2026-09-24.at.11.16.48.mov

@codecov

codecov Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/components/Charts/utils/index.ts 71.42% <100.00%> (+0.31%) ⬆️
src/components/Search/buildChartSeries.ts 100.00% <100.00%> (ø)
src/libs/PercentageUtils.ts 100.00% <100.00%> (ø)
src/styles/index.ts 63.90% <ø> (+0.61%) ⬆️
src/components/Charts/hooks/useTooltipData.ts 0.00% <0.00%> (ø)
src/components/Charts/PieChart/PieChartContent.tsx 0.00% <0.00%> (ø)
src/pages/Insights/InsightsDashboard.tsx 0.00% <0.00%> (ø)
src/pages/Insights/charts/InsightsChartWidget.tsx 0.00% <0.00%> (ø)
...ages/Insights/charts/InsightsDataTableSkeleton.tsx 51.61% <51.61%> (ø)
src/components/Search/SearchChartView.tsx 0.00% <0.00%> (-4.55%) ⬇️
... and 1 more
... and 6 files with indirect coverage changes

@melvin-bot

melvin-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx bun ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx bun ./scripts/generateTranslations.ts --compare-ref main

@OlGierd03 OlGierd03 changed the title [Insights][R1][App] Render the chart inline table [No QA][Insights][R1][App] Render the chart inline table Sep 13, 2026
@OlGierd03

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 12e63d022e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mhawryluk

Copy link
Copy Markdown
Member

the 16px horizontal padding on the rows from the design is missing Zrzut ekranu 2026-09-14 o 12 23 59

@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index 8401d159..b7ccbf94 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -9690,6 +9690,7 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
             title: 'Berichte zusammenführen',
             description: 'Wählen Sie den Bericht aus, der beibehalten werden soll. Alle Ausgaben werden in ihn verschoben und die anderen Berichte werden gelöscht.',
         },
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} der Ausgaben`,
     },
     genericErrorPage: {
         title: 'Ups, da ist etwas schiefgelaufen!',
diff --git a/src/languages/el.ts b/src/languages/el.ts
index ee582c48..4779ee25 100644
--- a/src/languages/el.ts
+++ b/src/languages/el.ts
@@ -9887,6 +9887,7 @@ ${reportName}`,
             title: 'Λήψη κατάστασης',
             oneFeedAtATime: 'Παρακαλούμε επιλέγετε διακανονισμούς από μία ροή Κάρτας Expensify κάθε φορά.',
         },
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} των δαπανών`,
     },
     genericErrorPage: {
         title: 'Ωχ, κάτι πήγε στραβά!',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index e8f40948..1b40ba43 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -9520,6 +9520,7 @@ ${reportName}`,
             pleaseSelectDatesForBothFromAndTo: 'Por favor, selecciona fechas para Desde y Hasta',
         },
         mergeReports: {title: 'Combinar informes', description: 'Selecciona el informe que quieres conservar. Todos los gastos se moverán a él y los demás informes se eliminarán.'},
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} del gasto`,
     },
     genericErrorPage: {
         title: '¡Oh-oh, algo salió mal!',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index c57e0185..f8499ed7 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -9710,6 +9710,7 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
             title: 'Fusionner des notes de frais',
             description: 'Sélectionnez la note de frais à conserver. Toutes les dépenses y seront déplacées et les autres notes de frais seront supprimées.',
         },
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} des dépenses`,
     },
     genericErrorPage: {
         title: 'Oups, quelque chose s’est mal passé !',
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 99ae8352..197b7e50 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -9645,6 +9645,7 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
             violationsBySubmitter: 'Violazioni da parte dell’autore dell’invio',
         },
         mergeReports: {title: 'Unisci report', description: 'Seleziona il report da mantenere. Tutte le spese verranno spostate al suo interno e gli altri report verranno eliminati.'},
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} della spesa`,
     },
     genericErrorPage: {
         title: 'Oops, qualcosa è andato storto!',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index c0450874..50729c98 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -9512,6 +9512,7 @@ ${reportName}`,
             violationsBySubmitter: '申請者による違反',
         },
         mergeReports: {title: 'レポートをマージする', description: '保持するレポートを選択してください。すべての経費はそのレポートに移動され、他のレポートは削除されます。'},
+        percentOfSpend: ({percent}: {percent: string}) => `支出の${percent}`,
     },
     genericErrorPage: {
         title: 'おっと、問題が発生しました!',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 510de3dc..82b97af5 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -9616,6 +9616,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
             title: 'Rapporten samenvoegen',
             description: 'Selecteer het rapport dat je wilt behouden. Alle uitgaven worden daarheen verplaatst en de andere rapporten worden verwijderd.',
         },
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} van de uitgaven`,
     },
     genericErrorPage: {
         title: 'Oeps, er is iets misgegaan!',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 9403c8a3..f7bab70d 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -9636,6 +9636,7 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
             violationsBySubmitter: 'Naruszenia przez zgłaszającego',
         },
         mergeReports: {title: 'Połącz raporty', description: 'Wybierz raport, który chcesz zachować. Wszystkie wydatki zostaną do niego przeniesione, a pozostałe raporty zostaną usunięte.'},
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} wydatków`,
     },
     genericErrorPage: {
         title: 'Ups, coś poszło nie tak!',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 7cde0d05..f51d6ffa 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -9616,6 +9616,7 @@ Adicione mais regras de gasto para proteger o fluxo de caixa da empresa.`,
             title: 'Mesclar relatórios',
             description: 'Selecione o relatório que você quer manter. Todas as despesas serão movidas para ele e os outros relatórios serão excluídos.',
         },
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} do gasto`,
     },
     genericErrorPage: {
         title: 'Opa, algo deu errado!',
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index e4c44270..ac5b4ead 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -9264,6 +9264,7 @@ ${reportName}`,
             violationsBySubmitter: '提交人违规',
         },
         mergeReports: {title: '合并报表', description: '选择要保留的报表。所有费用都将移入该报表,其他报表将被删除。'},
+        percentOfSpend: ({percent}: {percent: string}) => `${percent} 的支出`,
     },
     genericErrorPage: {
         title: '哎呀,出错了!',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

Comment thread src/components/Search/types.ts Resolved
Comment thread tests/unit/buildChartSeriesTest.ts Resolved
@OlGierd03
OlGierd03 marked this pull request as ready for review September 15, 2026 16:45
@OlGierd03
OlGierd03 requested a review from a team as a code owner September 15, 2026 16:45
@dannymcclain

Copy link
Copy Markdown
Contributor

Will let @dannymcclain steer this one though!

Yeah so we want the horizontal dividers to extend all the way to the edge, and then we want the same padding on those rows as the main card so that everything lines up nicely on these orange "key lines" I'm showing here in this screenshot:

CleanShot 2026-09-23 at 15 12 42@2x

On these desktop cards that should 32px. Let me know if that makes sense!

@OlGierd03

OlGierd03 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

It sure does make sense. Thanks for the explanation 🚀

@OlGierd03

Copy link
Copy Markdown
Contributor Author

@daledah @dannymcclain I've addressed both the new design and the review

Copy link
Copy Markdown
Contributor

Awesome, let's get this back into a (final?) review.

@cristipaval

Copy link
Copy Markdown
Contributor

@cristipaval @aldo-expensify In this PR, we decided to unify how percentages of total spend are calculated for all charts in the app. The new method requires the percentOfTotal field. Currently, GetInsights always returns it, but in Spend, which was not originally intended to be affected by these changes, query does not always return it. As a result, after my changes, for certain groupBy the Saved Searches charts in Spend no longer display percentages, unlike how they did before. I’ve noticed that they aren’t provided, for example, for groupBy:year and groupBy:quarter. Could we standardize the responses and always include this data?

yes we can! I created an issue for this. I'm on it

luacmartins
luacmartins previously approved these changes Sep 24, 2026

@luacmartins luacmartins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luacmartins

Copy link
Copy Markdown
Contributor

@daledah please prioritize this review when you're available

@luacmartins
luacmartins requested a review from daledah September 24, 2026 17:25
aldo-expensify
aldo-expensify previously approved these changes Sep 24, 2026

@daledah daledah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daledah

daledah commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@OlGierd03 please resolve conflict

@cristipaval
cristipaval merged commit 80284a7 into Expensify:main Sep 25, 2026
37 of 38 checks passed
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 cristipaval has triggered a test Expensify/App build. You can view the workflow run here.

@luacmartins luacmartins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Great job on this one!

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/cristipaval in version: 9.4.94-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.94-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.