You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Chart should maintain aspect ratio when window/screen size changes #92147
The chart does not maintain its aspect ratio when the window (or screen) size changes. Instead, it shrinks in an awkward, non-proportional way. The expected behavior is that the chart should scale uniformly — like any other image — so that the entire chart shrinks proportionally as the viewport shrinks.
This is a general issue on web, but critical on mobile where screen real estate is limited and non-uniform scaling can make the chart unusable.
Expected behavior
When the window or screen size changes, the chart should scale proportionally (maintaining its aspect ratio), similar to how a standard <img> element would respond to a responsive container.
Actual behavior
The chart shrinks in a disproportionate/unexpected way when the viewport is reduced, rather than scaling uniformly.
Platforms affected
Web
Mobile (iOS / Android) — high priority
Notes
Maintaining aspect ratio is a core UX concern on mobile given the limited screen size. A responsive, aspect-ratio-preserving layout is the correct behavior.
ℹ️ This looks like a duplicate of #91515 (status: Reviewing), which tracks the same Victory Chart aspect-ratio bug introduced in #90253. The analysis below is provided in case it's useful while triaging.
Proposal
What is the root cause of that problem?
The Victory Chart container has a fixed pixel height but a fluid width, so as the viewport shrinks the chart compresses horizontally while its height stays constant — aspect ratio is not preserved.
Specifically, the chartContent style hard-codes height: 250 while the outer wrappers apply maxWidth: '100%':
parseStyles.ts:14-21 — when the HTML element passes width/height attributes, they're applied independently with no aspectRatio derived from them
Mobile and web share the same code path (the .native.tsx variant just re-exports BaseVictoryChartRenderer), so the bug manifests identically — but it's more painful on mobile where the viewport is small and the squashing is more pronounced.
What changes do you think we should make in order to solve the problem?
Drive sizing by an aspect ratio derived from the <victorychart width="..." height="..."> HTML attributes, instead of a constant pixel height:
In parseStyles.ts, when both width and height are provided on the <victorychart> element, emit aspectRatio: parsedWidth / parsedHeight into the parsed style (and stop emitting a fixed height).
In VictoryChartContainer.tsx, let the parsed aspectRatio win over chartContent.height. Keep minHeight: CHART_CONTENT_MIN_HEIGHT as a floor so very narrow viewports don't collapse the chart entirely.
If no width/height attributes are present, fall back to a sensible default aspect ratio (e.g. matching the current 680×430 ≈ 1.58) instead of fixed height.
aspectRatio is supported by both React Native and the web. This makes the chart scale uniformly on resize without any transform tricks.
What alternative solutions did you explore? (Optional)
transform: scale(s) on the outer wrapper — rejected: doesn't change layout flow on web, and the Skia canvas in victory-native's CartesianChart would still rasterize at the original size, producing blurry/clipped output.
SVG viewBox + preserveAspectRatio — not applicable: the rendering goes through victory-native's CartesianChart (Skia), not a raw SVG, so there's no viewBox to set at the top level.
Data flow evidence
Chat HTML contains <victorychart width=W height=H> (introduced in #90253)
parseStyles accepts explicit width/height numbers but does NOT compute aspect ratio — the fixed chartContent.height wins
CartesianChart fills its parent View, so the Skia canvas's coordinate space gets non-uniformly remapped on resize, compressing bars/lines horizontally
Related issues
#91515 — same aspect-ratio bug, currently in Reviewing. The contributor team should consider closing this issue as a duplicate.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/92147) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
changed the title [-]Chart should maintain aspect ratio when window/screen size changes[/-][+][$250] Chart should maintain aspect ratio when window/screen size changes[/+]on May 30, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-30 23:59:40 UTC.
Replaces my earlier proposal. The earlier draft targeted the search/home chart components. The verified root cause is in the HTML Victory chart renderer: numeric width and height are applied independently, so max-width clamps only the width and leaves the height fixed.
Proposal
What is the root cause of that problem?
The affected chart path is the HTML Victory chart renderer, where custom <victorychart> blocks are registered as renderable HTML nodes and routed to VictoryChartRenderer:
So when a viewport becomes narrower than the original chart width, maxWidth: '100%' clamps only the width. The fixed numeric height remains unchanged, so Victory/Skia redraws into a narrower-but-equally-tall canvas instead of scaling the full chart rectangle proportionally.
What changes do you think we should make in order to solve the problem?
Change the Victory chart sizing contract so a numeric width/height pair is treated as an intrinsic size, not two independent responsive dimensions.
Concretely, update parseStyles() after all attribute and style.data merging is complete. When the final node style has a positive numeric width and height, convert that pair into responsive image-style sizing: preserve the original width as the maximum rendered width, set the rendered width to fill the available container up to that maximum, remove the fixed height, and set aspectRatio to width / height. Leave single-dimension, percentage/string, and explicit parent styles unchanged.
Add focused coverage for parseStyles() so a width=450 height=300 chart returns a style equivalent to width: '100%', maxWidth: 450, aspectRatio: 1.5, and no fixed height, while width-only and height-only charts keep their current behavior.
Scope boundaries: touch src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.ts and, only if needed for layout alignment, src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/components/VictoryChartContainer.tsx. This affects rendered HTML Victory charts on web, mWeb, desktop, iOS, and Android through the shared renderer. It does not change the search/home chart components in src/components/Charts, chart data parsing, Victory axis/domain settings, tooltip behavior, or backend/API behavior.
What alternative solutions did you explore? (Optional)
Updating the search chart components would not fix this HTML-rendered chart path; those components have their own dashboard layout and do not parse <victorychart width height> from report HTML.
Only removing styles.mw100 would prevent width clamping, but then charts would overflow small screens. Scaling the whole chart with a transform would preserve visuals but would make layout height, hit testing, and tooltip coordinates fragile. Using aspectRatio from the intrinsic width/height pair fixes the layout at the source while keeping the existing Victory render and interaction code intact.
⚠️@ReaperOAK Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
⚠️@aswin-s Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
The chart squashes horizontally instead of scaling proportionally because its wrapper resolves to a fixed pixel height against a fluid width — so when the viewport narrows, the width shrinks but the height cannot.
Root cause
victory-native v41 (^41.21.0) renders the chart into a Skia Canvas that fills the measured box of its parent View. The chart's on-screen dimensions are therefore exactly whatever Yoga resolves for the content wrapper in VictoryChartContainer. Two layered issues make that box non-proportional:
1 - The content wrapper pins a fixed height against a fluid width.
styles.chartContent hard-codes a height (src/styles/index.ts:6090-6092 → {height: CHART_CONTENT_MIN_HEIGHT}, with CHART_CONTENT_MIN_HEIGHT = 250 in src/components/Charts/VictoryTheme.ts:85), while styles.mw100 (src/styles/utils/sizing.ts:150-152 → {maxWidth: '100%'}) only ever clamps the width. Width is fluid; height is frozen.
2 - The per-chart width/height attributes are applied as independent fixed pixels, with no aspect ratio tying them together.
The backend emits <victorychart width="W" height="H" …>. Those attributes are turned into styles in src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.ts:14-21:
nodeStyles becomes chartContentStyles, the last entry in the inner View's style array (so it wins). The effective inner-View style resolves to {height: H, maxWidth: '100%', width: W}. maxWidth: '100%' clamps the width down to the parent, but there is no maxHeight and no aspectRatio, so H stays frozen. A 400×250 chart dropped into a 200px-wide column renders as a 200×250 box — precisely the "shrinks in an awkward, non-proportional way" reported. It is worst for <victorypie>, whose radius is min(width, height): the circle collapses to the smaller axis and leaves a tall empty band, which is why it reads as "unusable" on the narrow mobile viewport.
Proposed fix
Derive the aspect ratio from the intrinsic width/height in parseStyles, and let the height follow the resolved (clamped) width instead of pinning both axes independently. Replace lines 14-21 of parseStyles.ts:
// src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.tsconstparsedHeight=parseAttribute(tnode.attributes.height);constparsedWidth=parseAttribute(tnode.attributes.width);if(typeofparsedWidth==='number'&&typeofparsedHeight==='number'&&parsedHeight>0){// Scale uniformly like an <img>: cap at the intrinsic size, then let aspectRatio derive// the height from whatever width the responsive container resolves to.// maxWidth/maxHeight must both be set because aspectRatio is computed first and the// max* values clamp the result (see expenseViewImageSmall in styles/index.ts).nodeStyles.maxWidth=parsedWidth;nodeStyles.maxHeight=parsedHeight;nodeStyles.aspectRatio=parsedWidth/parsedHeight;nodeStyles.height='auto';}else{if(typeofparsedHeight==='number'){nodeStyles.height=parsedHeight;}if(typeofparsedWidth==='number'){nodeStyles.width=parsedWidth;}}
Because chartContentStyles is applied last in VictoryChartContainer, the height: 'auto' + aspectRatio override automatically neutralizes the leftover height: 250 from styles.chartContent for any dimensioned chart — no edit is needed there. The inner View now stretches to the available width (bounded by maxWidth), and Yoga derives the height from the ratio, so the box stays proportional at every viewport size. Walking the 400×250 example through the fix: a 200px-wide parent yields width = 200, height = 200 / (400/250) = 125 — aspect ratio preserved instead of 200×250.
No .native divergence is required: web and native share BaseVictoryChartRenderer (index.native.tsx simply re-exports it), so the single parseStyles change fixes both platforms in one place.
Why this approach
This mirrors the established responsive-image pattern already used for receipts in this codebase — expenseViewImage and expenseViewImageSmall at src/styles/index.ts:4743-4754, which combine maxWidth + maxHeight + aspectRatio + height: 'auto' to make an image "scale uniformly like an <img>," the exact behavior the issue asks for. The inline comment there ("aspectRatio is calculated first and then maxWidth/maxHeight clamps the dimensions, thus both have to be specified") is the reason both maxWidth and maxHeight are set above rather than aspectRatio alone.
Fixing it in parseStyles is preferable to hardcoding an aspectRatio on styles.chartContent, because the ratio is per-chart and only known from the node's width/height attributes — a static style value would force one ratio onto every chart. Wrapping the chart in a fixed-pixel box was also rejected: it reintroduces the same non-responsive behavior the issue is about. The change is purely client-side layout (no parser or data-path impact), and the existing chartContent.height continues to serve only as the fallback for the rare chart that ships without width/height, where no ratio can be derived.
⚠️@15antonian Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
The root cause lies in parseStyles.ts, where numeric width and height attributes from <victorychart> HTML nodes are applied as two independent fixed pixel values with no relationship between them. When maxWidth: '100%' (from styles.mw100) clamps the width to fit the viewport, there is nothing to proportionally reduce the height — it stays frozen at whatever pixel value was parsed from the height attribute, or falls back to the hardcoded CHART_CONTENT_MIN_HEIGHT = 250 from styles.chartContent.
The inner View in VictoryChartContainer.tsx resolves its styles in this order:
chartContentStyles (from parseStyles) wins, but it only carries {width: W, height: H}. So on a narrow viewport, the chart box becomes something like 200×300 instead of the correct proportional 200×125 — exactly the non-uniform squashing reported.
What changes should be made to solve the problem?
The fix should be contained entirely in parseStyles.ts. When both width and height attributes are present and valid numbers, instead of emitting two fixed pixel values, we should derive an aspectRatio and let height follow the resolved width naturally — the same pattern already used for receipt images in this codebase (expenseViewImageSmall in styles/index.ts uses maxWidth + maxHeight + aspectRatio + height: 'auto' for exactly this reason).
Because chartContentStyles is the last entry in the View's style array, height: 'auto' and aspectRatio override the hardcoded height: 250 from styles.chartContent automatically — no changes needed in VictoryChartContainer.tsx or styles/index.ts.
Charts that ship without both width and height attributes keep their current behavior unchanged.
What alternative solutions were explored?
Applying a transform: scale() on the wrapper was rejected — it does not affect layout flow on web, and the Skia canvas inside victory-native would rasterize at the original dimensions, causing blurry or clipped output.
Removing styles.mw100 entirely was rejected — charts would overflow narrow viewports instead of scaling down.
Hardcoding a fixed aspectRatio on styles.chartContent was rejected — the correct ratio is per-chart and only knowable from the node's width/height attributes at parse time.
Since index.native.tsx simply re-exports BaseVictoryChartRenderer, this single change to parseStyles.ts fixes both web and mobile in one place with no platform divergence required.
📣 @ahsan3219! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
⚠️@wildan-m Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Activity
MelvinBot commentedon May 30, 2026
Proposal
What is the root cause of that problem?
The Victory Chart container has a fixed pixel height but a fluid width, so as the viewport shrinks the chart compresses horizontally while its height stays constant — aspect ratio is not preserved.
Specifically, the
chartContentstyle hard-codesheight: 250while the outer wrappers applymaxWidth: '100%':src/styles/index.ts:6087-6092—chartContent: { height: CHART_CONTENT_MIN_HEIGHT }(constant = 250)VictoryChartContainer.tsx:9-13— both nestedViews usemw100(maxWidth: 100%) for width but inherit the fixed heightVictoryTheme.ts:85—CHART_CONTENT_MIN_HEIGHT = 250parseStyles.ts:14-21— when the HTML element passeswidth/heightattributes, they're applied independently with noaspectRatioderived from themMobile and web share the same code path (the
.native.tsxvariant just re-exportsBaseVictoryChartRenderer), so the bug manifests identically — but it's more painful on mobile where the viewport is small and the squashing is more pronounced.What changes do you think we should make in order to solve the problem?
Drive sizing by an aspect ratio derived from the
<victorychart width="..." height="...">HTML attributes, instead of a constant pixel height:parseStyles.ts, when bothwidthandheightare provided on the<victorychart>element, emitaspectRatio: parsedWidth / parsedHeightinto the parsed style (and stop emitting a fixedheight).VictoryChartContainer.tsx, let the parsedaspectRatiowin overchartContent.height. KeepminHeight: CHART_CONTENT_MIN_HEIGHTas a floor so very narrow viewports don't collapse the chart entirely.aspectRatiois supported by both React Native and the web. This makes the chart scale uniformly on resize without any transform tricks.What alternative solutions did you explore? (Optional)
transform: scale(s)on the outer wrapper — rejected: doesn't change layout flow on web, and the Skia canvas invictory-native'sCartesianChartwould still rasterize at the original size, producing blurry/clipped output.viewBox+preserveAspectRatio— not applicable: the rendering goes throughvictory-native'sCartesianChart(Skia), not a raw SVG, so there's noviewBoxto set at the top level.Data flow evidence
<victorychart width=W height=H>(introduced in #90253)VictoryChartRenderer→BaseVictoryChartRenderer→VictoryChartContainerVictoryChartContainerrenders nestedViews: outermw100 + chartContainer, innermw100 + chartContent(fixed height 250px)parseStylesaccepts explicit width/height numbers but does NOT compute aspect ratio — the fixedchartContent.heightwinsCartesianChartfills its parentView, so the Skia canvas's coordinate space gets non-uniformly remapped on resize, compressing bars/lines horizontallyRelated issues
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/92147)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon May 30, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (
External)melvin-bot commentedon May 30, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022060871654030567102
[-]Chart should maintain aspect ratio when window/screen size changes[/-][+][$250] Chart should maintain aspect ratio when window/screen size changes[/+]KJ21-ENG commentedon May 30, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-30 23:59:40 UTC.
Proposal
What is the root cause of that problem?
The affected chart path is the HTML Victory chart renderer, where custom
<victorychart>blocks are registered as renderable HTML nodes and routed toVictoryChartRenderer:App/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
Lines 203 to 234 in 3ec7273
App/src/components/HTMLEngineProvider/HTMLRenderers/index.ts
Lines 62 to 63 in 3ec7273
That renderer copies numeric
widthandheightfrom the<victorychart>node directly onto the inner chart view:App/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.ts
Lines 14 to 21 in 3ec7273
Those parsed styles are then passed through context and applied after the shared
styles.chartContentandstyles.mw100styles:App/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx
Lines 34 to 38 in 3ec7273
App/src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/components/VictoryChartContainer.tsx
Lines 10 to 11 in 3ec7273
So when a viewport becomes narrower than the original chart width,
maxWidth: '100%'clamps only the width. The fixed numeric height remains unchanged, so Victory/Skia redraws into a narrower-but-equally-tall canvas instead of scaling the full chart rectangle proportionally.What changes do you think we should make in order to solve the problem?
Change the Victory chart sizing contract so a numeric width/height pair is treated as an intrinsic size, not two independent responsive dimensions.
Concretely, update
parseStyles()after all attribute andstyle.datamerging is complete. When the final node style has a positive numericwidthandheight, convert that pair into responsive image-style sizing: preserve the original width as the maximum rendered width, set the rendered width to fill the available container up to that maximum, remove the fixed height, and setaspectRatiotowidth / height. Leave single-dimension, percentage/string, and explicit parent styles unchanged.Add focused coverage for
parseStyles()so awidth=450 height=300chart returns a style equivalent towidth: '100%',maxWidth: 450,aspectRatio: 1.5, and no fixedheight, while width-only and height-only charts keep their current behavior.Scope boundaries: touch
src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.tsand, only if needed for layout alignment,src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/components/VictoryChartContainer.tsx. This affects rendered HTML Victory charts on web, mWeb, desktop, iOS, and Android through the shared renderer. It does not change the search/home chart components insrc/components/Charts, chart data parsing, Victory axis/domain settings, tooltip behavior, or backend/API behavior.What alternative solutions did you explore? (Optional)
Updating the search chart components would not fix this HTML-rendered chart path; those components have their own dashboard layout and do not parse
<victorychart width height>from report HTML.Only removing
styles.mw100would prevent width clamping, but then charts would overflow small screens. Scaling the whole chart with a transform would preserve visuals but would make layout height, hit testing, and tooltip coordinates fragile. UsingaspectRatiofrom the intrinsic width/height pair fixes the layout at the source while keeping the existing Victory render and interaction code intact.ReaperOAK commentedon May 30, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 30, 2026
aswin-s commentedon May 30, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 30, 2026
trasnake87 commentedon May 30, 2026
Proposal
The chart squashes horizontally instead of scaling proportionally because its wrapper resolves to a fixed pixel height against a fluid width — so when the viewport narrows, the width shrinks but the height cannot.
Root cause
victory-nativev41 (^41.21.0) renders the chart into a SkiaCanvasthat fills the measured box of its parentView. The chart's on-screen dimensions are therefore exactly whatever Yoga resolves for the content wrapper inVictoryChartContainer. Two layered issues make that box non-proportional:1 - The content wrapper pins a fixed height against a fluid width.
src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/components/VictoryChartContainer.tsx:9-13:styles.chartContenthard-codes a height (src/styles/index.ts:6090-6092→{height: CHART_CONTENT_MIN_HEIGHT}, withCHART_CONTENT_MIN_HEIGHT = 250insrc/components/Charts/VictoryTheme.ts:85), whilestyles.mw100(src/styles/utils/sizing.ts:150-152→{maxWidth: '100%'}) only ever clamps the width. Width is fluid; height is frozen.2 - The per-chart
width/heightattributes are applied as independent fixed pixels, with no aspect ratio tying them together.The backend emits
<victorychart width="W" height="H" …>. Those attributes are turned into styles insrc/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/parseStyles.ts:14-21:nodeStylesbecomeschartContentStyles, the last entry in the innerView's style array (so it wins). The effective inner-View style resolves to{height: H, maxWidth: '100%', width: W}.maxWidth: '100%'clamps the width down to the parent, but there is nomaxHeightand noaspectRatio, soHstays frozen. A 400×250 chart dropped into a 200px-wide column renders as a 200×250 box — precisely the "shrinks in an awkward, non-proportional way" reported. It is worst for<victorypie>, whose radius ismin(width, height): the circle collapses to the smaller axis and leaves a tall empty band, which is why it reads as "unusable" on the narrow mobile viewport.Proposed fix
Derive the aspect ratio from the intrinsic
width/heightinparseStyles, and let the height follow the resolved (clamped) width instead of pinning both axes independently. Replace lines 14-21 ofparseStyles.ts:Because
chartContentStylesis applied last inVictoryChartContainer, theheight: 'auto'+aspectRatiooverride automatically neutralizes the leftoverheight: 250fromstyles.chartContentfor any dimensioned chart — no edit is needed there. The innerViewnow stretches to the available width (bounded bymaxWidth), and Yoga derives the height from the ratio, so the box stays proportional at every viewport size. Walking the 400×250 example through the fix: a 200px-wide parent yieldswidth = 200,height = 200 / (400/250) = 125— aspect ratio preserved instead of200×250.No
.nativedivergence is required: web and native shareBaseVictoryChartRenderer(index.native.tsxsimply re-exports it), so the singleparseStyleschange fixes both platforms in one place.Why this approach
This mirrors the established responsive-image pattern already used for receipts in this codebase —
expenseViewImageandexpenseViewImageSmallatsrc/styles/index.ts:4743-4754, which combinemaxWidth+maxHeight+aspectRatio+height: 'auto'to make an image "scale uniformly like an<img>," the exact behavior the issue asks for. The inline comment there ("aspectRatio is calculated first and then maxWidth/maxHeight clamps the dimensions, thus both have to be specified") is the reason bothmaxWidthandmaxHeightare set above rather thanaspectRatioalone.Fixing it in
parseStylesis preferable to hardcoding anaspectRatioonstyles.chartContent, because the ratio is per-chart and only known from the node'swidth/heightattributes — a static style value would force one ratio onto every chart. Wrapping the chart in a fixed-pixel box was also rejected: it reintroduces the same non-responsive behavior the issue is about. The change is purely client-side layout (no parser or data-path impact), and the existingchartContent.heightcontinues to serve only as the fallback for the rare chart that ships withoutwidth/height, where no ratio can be derived.KJ21-ENG commentedon May 30, 2026
Updated my proposal — root cause is the HTML Victory renderer applying numeric width/height independently, not the search chart components.
15antonian commentedon May 31, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 31, 2026
ahsan3219 commentedon May 31, 2026
Proposal
What is the root cause of the problem?
The root cause lies in
parseStyles.ts, where numericwidthandheightattributes from<victorychart>HTML nodes are applied as two independent fixed pixel values with no relationship between them. WhenmaxWidth: '100%'(fromstyles.mw100) clamps the width to fit the viewport, there is nothing to proportionally reduce the height — it stays frozen at whatever pixel value was parsed from theheightattribute, or falls back to the hardcodedCHART_CONTENT_MIN_HEIGHT = 250fromstyles.chartContent.The inner
ViewinVictoryChartContainer.tsxresolves its styles in this order:chartContentStyles(fromparseStyles) wins, but it only carries{width: W, height: H}. So on a narrow viewport, the chart box becomes something like200×300instead of the correct proportional200×125— exactly the non-uniform squashing reported.What changes should be made to solve the problem?
The fix should be contained entirely in
parseStyles.ts. When bothwidthandheightattributes are present and valid numbers, instead of emitting two fixed pixel values, we should derive anaspectRatioand let height follow the resolved width naturally — the same pattern already used for receipt images in this codebase (expenseViewImageSmallinstyles/index.tsusesmaxWidth + maxHeight + aspectRatio + height: 'auto'for exactly this reason).Proposed change to
parseStyles.ts(lines 14–21):Because
chartContentStylesis the last entry in theView's style array,height: 'auto'andaspectRatiooverride the hardcodedheight: 250fromstyles.chartContentautomatically — no changes needed inVictoryChartContainer.tsxorstyles/index.ts.Charts that ship without both
widthandheightattributes keep their current behavior unchanged.What alternative solutions were explored?
transform: scale()on the wrapper was rejected — it does not affect layout flow on web, and the Skia canvas insidevictory-nativewould rasterize at the original dimensions, causing blurry or clipped output.styles.mw100entirely was rejected — charts would overflow narrow viewports instead of scaling down.aspectRatioonstyles.chartContentwas rejected — the correct ratio is per-chart and only knowable from the node'swidth/heightattributes at parse time.Since
index.native.tsxsimply re-exportsBaseVictoryChartRenderer, this single change toparseStyles.tsfixes both web and mobile in one place with no platform divergence required.melvin-bot commentedon May 31, 2026
📣 @ahsan3219! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
wildan-m commentedon May 31, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon May 31, 2026
quinthar commentedon May 31, 2026
Whoops, this issue is a dupe of #91515; closing.