App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Insights - KZT currency symbol is shown as empty box on chart axis

Open applause-bot[bot] opened this issue 6 days ago • 9 comments

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


Version Number: 9.5.54-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/107748 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: macOS / Chrome App Component: Other

Action Performed:

Precondition: Control workspace with KZT default currency and a few expenses.

  1. Open staging.new.expensify.com
  2. Go to Insights > Spend
  3. Make sure Group currency is KZT
  4. Wait for charts to load
  5. Look at the axis labels on Spend over time, Top spenders and Top merchants charts

Expected Result:

Axis labels show the tenge symbol ₸ (e.g. ₸800), the same way other currencies show their symbols (₹800, ₽100).

Actual Result:

Axis labels show an empty box instead of the currency symbol (e.g. ▯800, ▯600) on all Insights charts. The app uses 〒 (U+3012, Japanese postal mark) as the KZT symbol instead of ₸ (U+20B8). The currency list shows "KZT - 〒". The chart font has no 〒 glyph, so it is drawn as an empty box. Other currencies render correctly on the same charts: USD ($), INR (₹), RUB (₽), THB (฿), AMD (դր), BGN (лв), GEL (ლ). Only KZT is broken.

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/af59055c-89be-423d-83e1-087752ae3c1b

View all open jobs on GitHub

Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7324395

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @luacmartins

applause-bot[bot] avatar Nov 25 '26 20:11 applause-bot[bot]

While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/7c866631c559b8a98e3d9da1446595fa608935f524cbc07a14653281919fea4f

applause-bot[bot] avatar Nov 25 '26 20:11 applause-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (External)

Job added to Upwork: https://www.upwork.com/jobs/~022125690486447560664

Proposal

What is the root cause of that problem?

Medium confidence: The evidence supports incorrect currency metadata combined with an inactive chart fallback.

Charts prioritize the supplied currency symbol over the browser’s localized symbol. If KZT supplies 〒 (Japanese postal mark), that incorrect character reaches the chart labels unchanged. Both affected chart implementations also omit the font manager required to activate the existing unsupported-character fallback.

Code evidence

Not independently verified: the affected session’s live metadata and loaded fonts. Consequently, the precise reason for the empty-box rendering remains unconfirmed.

What changes do you think we should make in order to solve the problem?

Escalate to an internal engineer before accepting an App-only fix. Currency metadata comes from OpenApp, outside this repository; the fixture documentation explicitly identifies that source and warns that fixtures can become outdated.

Confirm the live KZT symbol and identify its authoritative backend owner. Then verify that the correct ₸ renders across all three charts. The missing chart fallback is a separate confirmed integration gap, but addressing it alone would not establish the expected result.

What alternative solutions did you explore? (Optional)

  • Font-only change: Could make the postal mark visible, but would leave the wrong currency symbol.
  • Fixture-only change: Would not change production metadata.
  • Localized fallback alone: May display KZT, rather than the required ₸.

Next Steps for Contributor+ team: Internal verification is required before implementation. To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/108030) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Nov 25 '26 20:11 MelvinBot

Proposal

Please re-state the problem that we are trying to solve in this issue.

On Insights charts for a KZT workspace, the axis labels show an empty box (▯800) instead of the tenge symbol (₸800).

What is the root cause of that problem?

Two things combine:

  1. The currency list gives 〒 (U+3012) as the KZT symbol, and SearchChartView uses that list symbol first. It only falls back to the Intl symbol when the list has no symbol at all: https://github.com/Expensify/App/blob/179cb6263a4668c00a18429d5b3f707bef04570a/src/components/Search/SearchChartView.tsx#L247-L251 Also, that Intl fallback uses the default currencyDisplay: 'symbol', which gives the plain code KZT in en-US, not ₸.

  2. The charts already have a guard for this case. useChartLabelFormats swaps to unit.fallback when the chart fonts can't draw the unit: https://github.com/Expensify/App/blob/179cb6263a4668c00a18429d5b3f707bef04570a/src/components/Charts/hooks/useChartLabelFormats.ts#L41-L43 But it only does that when a fontManager is passed in, and none of the chart callers pass one. They pass it to the measurement and layout hooks right next to it, but not to this hook:

  • Bar charts (Top spenders, Top merchants, bar view): https://github.com/Expensify/App/blob/179cb6263a4668c00a18429d5b3f707bef04570a/src/components/Charts/BarChart/VerticalBarChartContent.tsx#L100-L105
  • Line chart (Spend over time): https://github.com/Expensify/App/blob/179cb6263a4668c00a18429d5b3f707bef04570a/src/components/Charts/LineChart/LineChartContent.tsx#L119-L124
  • Pie chart: https://github.com/Expensify/App/blob/179cb6263a4668c00a18429d5b3f707bef04570a/src/components/Charts/PieChart/PieChartContent.tsx#L100

So canFontRenderText is never run, 〒 reaches the Skia paragraph unchanged, and no font in the chart chain has that glyph, so it is drawn as ▯.

What changes do you think we should make in order to solve the problem?

Fix it in the App so it works whatever the backend symbol is:

  1. Pass the fontManager the chart content components already have (and useChartFontManager() in the pie chart) into useChartLabelFormats in the bar, line and pie charts. This turns on the existing glyph check, so a symbol the chart fonts can't draw is replaced by the fallback instead of a box.
  2. In SearchChartView, build the fallback symbol with currencyDisplay: 'narrowSymbol'. For KZT that gives ₸, which NotoSans-Symbols in the chart font chain can draw, so the label reads ₸800 as expected and doesn't fall back to KZT 800. Keep the currency code as the last fallback if even the narrow symbol isn't drawable.
  3. Optional and separate: ask internal to correct the KZT symbol in the backend currency list (〒 → ₸). This also fixes the currency picker ("KZT - 〒"). Steps 1 and 2 keep the charts safe from any other bad or unsupported symbol either way.

Unit tests: add useChartLabelFormats cases where an undrawable unit with a fontManager uses the fallback, and a SearchChartView case where KZT gives the ₸ fallback.

What alternative solutions did you explore? (Optional)

Only fixing the backend symbol. That fixes KZT but leaves every chart open to the same ▯ for any other symbol the chart fonts don't cover, because the existing guard stays switched off.

How this differs from MelvinBot's proposal: Melvin suggests escalating to an internal engineer before any App fix. This proposal is an App-only fix that can ship now. It turns on the existing fallback in all three chart types, including the pie chart, which Melvin didn't mention. It also makes the fallback the real tenge symbol ₸ (narrowSymbol) instead of KZT, which is what the expected result asks for.

Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01be5d412b545fdf18

akzkid avatar Nov 25 '26 20:11 akzkid

Proposal

Please re-state the problem that we are trying to solve in this issue?

On Insights charts (including Spend over time, Top spenders, and Top merchants), when a workspace's default currency is Kazakhstani Tenge (KZT), the chart's vertical axis tick labels render a missing glyph replacement box (e.g. ▯800, ▯600) instead of the tenge symbol (₸800) or clean currency representation.

What is the root cause of that problem?

There are two compounding defects across chart font fallback and currency formatting:

  1. fontManager is never passed into useChartLabelFormats by chart content components: In src/components/Charts/hooks/useChartLabelFormats.ts:41-43:

    const displayUnit = typeof unit === 'string' ? unit : unit?.value;
    const fallbackUnit = typeof unit === 'string' ? undefined : unit?.fallback;
    const unitToDisplay = fontManager && !canFontRenderText(displayUnit, fontManager) ? fallbackUnit : displayUnit;
    

    The useChartLabelFormats hook contains an intentional safeguard designed to detect when a unit glyph cannot be rendered by the chart's Skia typefaces via canFontRenderText(displayUnit, fontManager) and fall back to fallbackUnit.

    However, all three chart content components fail to pass fontManager into useChartLabelFormats:

    • src/components/Charts/BarChart/VerticalBarChartContent.tsx:100-105: Obtains const fontManager = useChartFontManager(); at line 86 (and passes it to getYAxisLabelWidth at line 108), but omits fontManager from useChartLabelFormats.
    • src/components/Charts/LineChart/LineChartContent.tsx:119-124: Obtains fontManager at line 98, but omits it from useChartLabelFormats.
    • src/components/Charts/PieChart/PieChartContent.tsx:100: Omits fontManager from useChartLabelFormats.

    Because fontManager is undefined, the condition fontManager && !canFontRenderText(...) is always falsy. The fallback mechanism is completely dormant, so whatever raw string is provided in unit.value is passed directly to the Skia text renderer.

  2. Currency list supplies Japanese postal mark 〒 (U+3012) for KZT instead of ₸ (U+20B8), and SearchChartView uses default currency display:

    • In tests/unit/currencyList.json:410-414 (and the backend currency list), KZT is defined with "symbol": "〒" (U+3012, Japanese postal mark) instead of "₸" (U+20B8, Kazakhstani Tenge).
    • In src/components/Search/SearchChartView.tsx:247-251:
      const parts = formatToParts(preferredLocale, 0, {style: 'currency', currency});
      const currencyIndex = parts.findIndex((p) => p.type === 'currency');
      const integerIndex = parts.findIndex((p) => p.type === 'integer');
      const intlSymbol = parts.find((p) => p.type === 'currency')?.value;
      const unit = isAmountMetric ? {value: getCurrencySymbol(currency) ?? intlSymbol ?? currency, fallback: intlSymbol ?? currency} : undefined;
      
      getCurrencySymbol('KZT') returns "〒". The Skia chart fonts bundled with the application (src/components/Charts/utils/chartFontAssets.ts: NotoSans-Symbols.ttf, ExpensifyNeue, etc.) do not have the Japanese postal mark glyph 〒 (U+3012). When Skia attempts to draw 〒, it renders an empty box ▯.
    • Furthermore, formatToParts(preferredLocale, 0, {style: 'currency', currency}) in en locale defaults to currencyDisplay: 'symbol', which for KZT returns the plain code "KZT" rather than the tenge symbol "₸". In contrast, passing {style: 'currency', currency, currencyDisplay: 'narrowSymbol'} returns the authentic tenge symbol "₸" (U+20B8), which NotoSans-Symbols.ttf can natively render.

What changes do you think we should make in order to solve the problem?

We resolve this robustly in the application layer:

  1. Activate the Skia glyph fallback by passing fontManager in all chart content components:

    • In src/components/Charts/BarChart/VerticalBarChartContent.tsx:100:
      @@ -102,6 +102,7 @@ function VerticalBarChartCanvas({
               unit: yAxisUnit,
               unitPosition: yAxisUnitPosition,
               formatValue: formatValueOverride,
      +        fontManager,
           });
      
    • In src/components/Charts/LineChart/LineChartContent.tsx:119:
      @@ -121,6 +121,7 @@ function LineChartCanvas({
               unit: yAxisUnit,
               unitPosition: yAxisUnitPosition,
               formatValue: formatValueOverride,
      +        fontManager,
           });
      
    • In src/components/Charts/PieChart/PieChartContent.tsx:100:
      @@ -1,5 +1,6 @@
       import {useReportChartLoading} from '@components/Charts/components/ChartReveal';
       import ChartTooltipLayer from '@components/Charts/components/ChartTooltipLayer';
      +import {useChartFontManager} from '@components/Charts/context/ChartFontsContext';
       import {CHART_GESTURE_TOUCH_ACTION, TOOLTIP_BAR_GAP, useChartLabelFormats, useTouchPinnedTooltip} from '@components/Charts/hooks';
      ...
      @@ -97,7 +98,8 @@ function PieChartCanvas({
           const [{key: primarySeriesKey}] = series;
           const processedSlices = processDataIntoSlices(data, primarySeriesKey, pieGeometry);
      
      -    const {formatValue, formatExactValue, formatTotalValue} = useChartLabelFormats({data, unit: valueUnit, unitPosition: valueUnitPosition, formatValue: formatValueOverride});
      +    const fontManager = useChartFontManager();
      +    const {formatValue, formatExactValue, formatTotalValue} = useChartLabelFormats({data, unit: valueUnit, unitPosition: valueUnitPosition, formatValue: formatValueOverride, fontManager});
      
  2. Use currencyDisplay: 'narrowSymbol' for chart axis formatting in SearchChartView: In src/components/Search/SearchChartView.tsx:247:

    @@ -244,7 +244,7 @@ function SearchChartView({
    
         const firstItem = data.at(0);
         const currency = sanitizeCurrencyCode(firstItem?.currency ?? CONST.CURRENCY.USD);
    -    const parts = formatToParts(preferredLocale, 0, {style: 'currency', currency});
    +    const parts = formatToParts(preferredLocale, 0, {style: 'currency', currency, currencyDisplay: 'narrowSymbol'});
         const currencyIndex = parts.findIndex((p) => p.type === 'currency');
         const integerIndex = parts.findIndex((p) => p.type === 'integer');
         const intlSymbol = parts.find((p) => p.type === 'currency')?.value;
    

    Now, when KZT is selected:

    • unit.value is "〒" (from currencyList) and unit.fallback is "₸" (from formatToParts with narrowSymbol).
    • canFontRenderText("〒", fontManager) returns false because NotoSans-Symbols.ttf lacks glyph 〒.
    • useChartLabelFormats immediately selects fallbackUnit ("₸").
    • canFontRenderText("₸", fontManager) returns true because NotoSans-Symbols.ttf natively supports U+20B8.
    • The chart displays ₸800, ₸600 perfectly on all axis labels as expected.
    • If any other currency symbol is missing from Skia typefaces, it falls back gracefully without ever drawing an empty box ▯.
  3. Separate backend task: Separately, internal team can update the backend currency dictionary (〒 -> ₸) so currency pickers also display ₸. Our frontend fix makes charts immediately resilient to any font-unsupported symbol.

What alternative solutions did you explore? (Optional)?

  • Only updating the backend currency list: Escalating to backend leaves the entire chart rendering pipeline vulnerable to ▯ box glyphs whenever any currency, custom unit, or localized symbol lacks typeface support in Skia. Activating fontManager in useChartLabelFormats is the correct, permanent architectural fix already envisioned in unit tests (tests/unit/components/Charts/useChartLabelFormats.test.ts:41).
Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

kevinjosh10 avatar Nov 25 '26 21:11 kevinjosh10

Screenshot 2026-11-26 at 09 29 40

The root cause appears to be that the backend returns 〒 (U+3012, the Japanese postal mark) as the KZT currency symbol instead of ₸ (U+20B8, the Kazakhstani tenge sign).

The chart font doesn't support the 〒 glyph, so Skia renders it as an empty box.

I tested the following change locally, and it fixed the issue:

Onyx.merge('currencyList', {KZT: {symbol: '₸'}})

Could someone from the backend team check this and update the KZT currency symbol accordingly?

🎀 👀 🎀 c+ reviewed.

huult avatar Nov 26 '26 02:11 huult

Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

PR in review

luacmartins avatar Nov 26 '26 17:11 luacmartins