Skip to content

fix(ui/chart): pin the left axis panel width - #26

Merged
mrcsin merged 1 commit into
masterfrom
chart-left-axis
Nov 17, 2026
Merged

mrcsin merged 1 commit into
masterfrom
chart-left-axis

Conversation

@mrcsin

@mrcsin mrcsin commented Nov 17, 2026

Copy link
Copy Markdown
Member

Problem

ScottPlot sized the left axis panel to its widest tick label. The data area therefore moved by about 15 px whenever the scale changed, for example between "100" and "15 000" when the trend switched normalization. The spectrum and trend data areas also started at different x.

Change

  • ChartAxisRegion.LeftPanelWidth = 112 px. ChartAxisRegion.PinLeftPanel sets the left axis MinimumSize and MaximumSize to it on both charts, as SemiPlot's ChartAxisBinder.AxisPanelWidth does.
  • The width is measured, not guessed. The widest tick the charts print is "65 535,25": the largest raw intensity with the two fraction digits of a near-flat signal. Beside the trend's two-line "Нормировано ×1000 / 2461 нм ±255 нм" label, it needs 107.7 px in Russian. The spectrum needs 86.5 px.
  • The new text-fit test TheWidestTickAndYLabelFitThePinnedLeftPanelOfBothCharts lifts the pin, measures ScottPlot's own panel size for those labels, and fails if they outgrow 112 px.
  • The spectrum chart floor in the tests grows from 400 to 440 px, so an ATP-8000 spectrum keeps four labelled wavelength ticks. The window's minimum width does not change, because the status bar sets it.
  • overview.md gets a "The left axis panel" section and the updated data-area widths: 817 px for the spectrum and 1129 px for the trend at the minimum width.

Verification

  • dotnet build -c Release: 0 warnings. dotnet test: 1135 passed.
  • dotnet format --verify-no-changes and terse on the changed files: exit 0.
  • The operator checked in the running app that the plot no longer moves on a scale change.
Per-task commits before collapse
a6e6522 fix(ui/chart): pin the left axis panel width

🤖 Generated with Claude Code

ScottPlot sized the left axis panel to its widest tick label, so the
data area moved by about 15 px whenever the scale changed, for example
between 100 and 15 000 when the trend switched normalization.

Both charts now pin the panel to one width through MinimumSize and
MaximumSize, as SemiPlot pins its axis panels, so the data area never
moves and the spectrum and trend data areas line up. The 112 px width
is measured: the widest tick, 65 535,25, beside the trend's two-line
normalized Y label needs 107.7 px, and a text-fit test holds it. The
spectrum chart floor in the tests grows from 400 to 440 px to keep four
wavelength ticks; the window's minimum width does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrcsin
mrcsin marked this pull request as ready for review November 17, 2026 09:33
@mrcsin
mrcsin merged commit 9cdc38b into master Nov 17, 2026
1 check passed
@mrcsin
mrcsin deleted the chart-left-axis branch November 17, 2026 09:37
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