Skip to content

fix(chart): render the delta under the pen's mask - #137

Merged
mrcsin merged 3 commits into
masterfrom
delta-pen-format
Oct 16, 2026
Merged

mrcsin merged 3 commits into
masterfrom
delta-pen-format

Conversation

@mrcsin

@mrcsin mrcsin commented Oct 16, 2026

Copy link
Copy Markdown
Member

Problem

The delta readout rendered the active pen's Δy under a fixed 0.###, whatever mask the pen carries. A pressure pen in the 1e-3..1e-6 range read every difference below 0.0005 as 0, and the readout disagreed with the precision the sidebar and the hover readout show for the same pen. The literal also sat outside PenValueFormat, which AGENTS.md names as the only owner of a pen's rendering.

What changed

  • PenValueFormat.FormatDifference(value, mask): the difference renders under the positive section of the pen's mask alone, or under 0.### when the mask is unusable. A reading's negative section may leave the sign out (0.0;0.0) and its zero section may print a dash for "no reading" (0.0;(0.0);-); neither suits a difference, which is often negative and often zero.
  • ChartDeltaCursorReader.FormatReadout takes the pen's mask; TrendChartViewModel.DeltaReadoutText passes the active pen's Pen.Format and raises DeltaReadoutText after a catalogue apply, so a mask edited in the pen editor reaches a readout already on screen.
  • Docs: charting.md (PenValueFormat), trend-interaction.md (delta cursors), AGENTS.md (the PenValueFormat rule names the delta readout).
Pen mask Δ Before After
none or unusable -1.5 -1.5 -1.5
0.00E+00 -1.2e-5 0 -1.20E-05
0.00 1 1 1.00
0.0;(0.0);- 0 0 0.0

Verification

  • SemiPlot.Tests.Unit: 2273 passed. New: ADifferenceRendersUnderThePositiveSectionOfTheMask (7 cases), FormatReadout_RendersTheDeltaYUnderThePensMask, DeltaMode_RendersTheDeltaYUnderTheActivePensMask_AndFollowsAMaskTheCatalogueChanges; the last fails with the new RaisePropertyChanged removed.
  • dotnet format --verify-no-changes (pre-commit hook) and terse clean.

The delta readout rendered the active pen's difference under a fixed 0.###, so a pressure pen read every difference below 0.0005 as 0. PenValueFormat.FormatDifference renders it under the positive section of the pen's mask, and a catalogue apply refreshes the readout.
A positive section carrying a literal +, ( or ) rendered a negative difference as -+5.0 or -(5.0), because .NET puts its own minus ahead of the section. FormatDifference drops those literals and keeps the exponent's sign.
@mrcsin
mrcsin merged commit ed40c9a into master Oct 16, 2026
2 checks passed
@mrcsin
mrcsin deleted the delta-pen-format branch October 16, 2026 15:04
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