Skip to content

fix(charts): axis labels fit, wrap or turn instead of overlapping; the SVG export reads the same - #1753

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
fix/chart-axis-labels
Oct 25, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
fix/chart-axis-labels

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

X labels under bar and line charts were cut at about ten characters and ran into their neighbours ("Precision Wirel…Noise Cancelli…"); the left axis showed the data maximum among round ticks (749.99 over 600); the SVG export drew every nth label with no fitting at all, raw numbers and no axis names.

  • ChartAxisLabels.planX (pure, tested) picks the layout for screen and SVG alike: one line → two lines → turned 45° (cut at 140 px) → every nth label turned, only as the last resort.
  • Left axis: a label that is not on a tick step is not drawn.
  • Pie legend: values formatted like the tooltips (1,234), full label on hover.
  • SVG: ticks as 1.2M, tooltips as 1,234,567, axis names, bottom margin that follows the labels.

Tests: planner (each layout, cut, thinning, empty), SVG (formatting, axis names, turned and wrapped labels). The existing chart tests are unchanged.

Not checked by eye after the change: I saw the before state in the running app (overlapping labels on 8 products), but my screenshot session of the after state was lost, so the layout is covered by the tests only.

…e SVG export reads the same

X labels were cut at ~10 characters and ran into each other. One planner
(ChartAxisLabels.planX) now picks, for screen and SVG alike: one line, two
lines, turned 45 degrees, and only as the last resort every nth label.
The left axis no longer shows the data maximum among round ticks (749.99
over 600). The pie legend formats values like the tooltips and shows the
full label on hover. The SVG gets formatted ticks (1.2M), axis names and a
bottom margin that follows the labels.
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 06b09b9 into dev Oct 25, 2026
16 checks passed
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.

1 participant