Skip to content

Implement Raw Spectrum Overlay#718

Merged
YukiMatsuzawa merged 4 commits intomasterfrom
feature/overlay-raw-spectrum
Mar 19, 2026
Merged

Implement Raw Spectrum Overlay#718
YukiMatsuzawa merged 4 commits intomasterfrom
feature/overlay-raw-spectrum

Conversation

@YukiMatsuzawa
Copy link
Copy Markdown
Contributor

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.

  • LineSpectrumControlSlim.cs and PenSelector.cs: Add StrokeDashArray support for customizable dashed lines in spectrum rendering.
  • SingleSpectrumModel.cs and SingleSpectrumViewModel.cs: Expose StrokeDashArray property and add model cloning for overlay functionality.
  • RawDecSpectrumsModel.cs and RawDecSpectrumsViewModel.cs: Implement raw spectrum overlay with dashed style and visibility toggle.
  • ExpRefView.xaml and MsSpectrumView.xaml: Add "Raw (dashed)" checkbox and bind StrokeDashArray and annotation visibility in the UI.

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.
@YukiMatsuzawa YukiMatsuzawa requested a review from Copilot March 19, 2026 10:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 StrokeDashArray support 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>();
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@YukiMatsuzawa YukiMatsuzawa merged commit 212f18b into master Mar 19, 2026
9 checks passed
@YukiMatsuzawa YukiMatsuzawa deleted the feature/overlay-raw-spectrum branch March 19, 2026 14:27
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.

2 participants