Merged
Conversation
Introduced the StrokeDashArray dependency property to allow customization of line dash patterns. Updated PenSelector and related logic to propagate and apply dash styles when rendering lines. Changes to LineBrush, LineThickness, or StrokeDashArray now correctly update the rendered output. Backward compatibility is maintained for existing usage.
Users can now overlay the raw spectrum as a dashed, dark gray line on Q1Deconvolution and Deconvolution spectrum charts. A new "Raw (dashed)" checkbox in the UI toggles the overlay's visibility. The overlay does not show annotations and is visually distinct. Implementation includes new properties for controlling overlay visibility, line style, and annotation display, with updates to models, viewmodels, and XAML bindings to support the feature. # Conflicts: # src/MSDIAL5/MsdialGuiApp/Model/Chart/RawDecSpectrumsModel.cs
Changed the default value of IsRawSpectrumOverlayVisible to true, making the raw spectrum overlay visible upon model initialization. This improves user experience by displaying the overlay without requiring manual activation.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new spectrum-plot rendering feature to overlay the raw spectrum as a dashed line on deconvoluted/reference spectrum views, including UI controls to toggle visibility and wiring to support dashed strokes and annotation visibility.
Changes:
- Introduces
StrokeDashArraysupport end-to-end (model → viewmodel → XAML → rendering control/pen selection). - Adds a “Raw (dashed)” overlay spectrum into the deconvolution/reference chart with a visibility toggle.
- Adds per-spectrum annotation visibility binding for the upper spectrum plot.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/MSDIAL5/MsdialGuiApp/ViewModel/Chart/SingleSpectrumViewModel.cs |
Exposes StrokeDashArray and IsAnnotationVisible from the model. |
src/MSDIAL5/MsdialGuiApp/ViewModel/Chart/RawDecSpectrumsViewModel.cs |
Exposes overlay visibility reactive property for UI binding. |
src/MSDIAL5/MsdialGuiApp/View/Chart/MsSpectrumView.xaml |
Binds StrokeDashArray into LineSpectrumControlSlim and binds annotation visibility for the upper plot. |
src/MSDIAL5/MsdialGuiApp/View/Chart/ExpRefView.xaml |
Adds “Raw (dashed)” checkbox to toggle overlay visibility. |
src/MSDIAL5/MsdialGuiApp/Model/Chart/SingleSpectrumModel.cs |
Adds dash/annotation properties and introduces a Clone() helper used for overlays. |
src/MSDIAL5/MsdialGuiApp/Model/Chart/RawDecSpectrumsModel.cs |
Creates/configures the raw dashed overlay spectrum model and toggles it via IsRawSpectrumOverlayVisible. |
src/Common/ChartDrawing/Design/PenSelector.cs |
Extends pen selection to optionally apply a dash style. |
src/Common/ChartDrawing/Chart/LineSpectrumControlSlim.cs |
Adds StrokeDashArray dependency property and propagates it into pen selection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+326
to
+338
| public DoubleCollection StrokeDashArray { | ||
| get => (DoubleCollection)GetValue(StrokeDashArrayProperty); | ||
| set => SetValue(StrokeDashArrayProperty, value); | ||
| } | ||
|
|
||
| private static void OnStrokeDashArrayChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { | ||
| var c = (LineSpectrumControlSlim)d; | ||
| c.OnStrokeDashArrayChanged((DoubleCollection)e.OldValue, (DoubleCollection)e.NewValue); | ||
| } | ||
|
|
||
| [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "<Pending>")] | ||
| private void OnStrokeDashArrayChanged(DoubleCollection oldValue, DoubleCollection newValue) { | ||
| Selector.Update(LineBrush, LineThickness, newValue); |
Comment on lines
34
to
79
| @@ -62,13 +67,15 @@ public Pen Get(object o) { | |||
|
|
|||
| class BrushMapStrategy : ISelectStrategy | |||
| { | |||
| public BrushMapStrategy(IBrushMapper mapper, double thickness) { | |||
| public BrushMapStrategy(IBrushMapper mapper, double thickness, DoubleCollection strokeDashArray) { | |||
| Mapper = mapper; | |||
| Thickness = thickness; | |||
| StrokeDashArray = strokeDashArray?.ToArray(); | |||
| } | |||
|
|
|||
| private readonly IBrushMapper Mapper; | |||
| private readonly double Thickness; | |||
| private readonly double[] StrokeDashArray; | |||
| private readonly Dictionary<object, Pen> cache = new Dictionary<object, Pen>(); | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Classification
New feature: adds support for customizable dashed line overlays for spectrum plots.
PR Summary
This pull request enables overlaying the raw spectrum as a dashed line on deconvoluted/reference spectrum views, with user control over its visibility and line style.