--- source_files: - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphMainView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphChannelView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphPropertyView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/ITestDataView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphPropertyViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/ITestDataSeriesView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/ITestDataViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/ITestDataSeriesViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphChannelViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/IGraphMainViewModel.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Graphs/ITestDataSeries.cs generated_at: "2026-04-16T02:33:34.206978+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "99208da86b0faad5" --- # Graph View Module Documentation ## 1. Purpose This module defines the interface contracts for the graphing subsystem within the DTS Viewer, enabling separation of concerns between UI views and their corresponding view models in a MVVM pattern. It provides a structured set of interfaces for managing graph displays, channel selection, test data series, and property views—supporting both time-domain and frequency-domain (FFT/PSD) visualization of test data. The interfaces collectively enable modular UI composition where graph-related functionality (e.g., channel grouping, cursor tracking, report export) is decoupled from implementation details. ## 2. Public Interface ### Interfaces (View Layer) - **`IGraphMainView`** Represents the main graph tab view. Inherits `IBaseView`. No additional members defined. - **`IGraphChannelView`** Represents the channel selection/view tab. Inherits `IBaseView`. No additional members defined. - **`IGraphPropertyView`** Represents the property display tab. Inherits `IBaseView`. No additional members defined. - **`ITestDataView`** Represents the test data tab. Inherits `IBaseView`. No additional members defined. - **`ITestDataSeriesView`** Represents the view for a single test data series. Inherits `IBaseView`. - `bool SaveReportToPDF(string directory)` – Saves the series report to PDF in the specified directory. - `bool SaveReportToCSV(string directory)` – Saves the series report to CSV in the specified directory. - **`IGraphView`** Represents the main graph display view. Inherits `IBaseView`. - *Commented-out method*: `void SetGraphs(ObservableCollection graphs);` — Not active in current interface. ### Interfaces (ViewModel Layer) - **`IGraphMainViewModel`** Manages the main graph view and channel/group selection logic. Inherits `IBaseViewModel`. - `IGraphMainView View { get; set; }` - `IBaseViewModel Parent { get; set; }` - `List LockedChannelList { get; set; }` - `List SelectedChannelList { get; set; }` - `string LockedGroupName { get; set; }` - `void PublishSelectedChannels()` – Commits selected channels for display. - `void AddSelectedChannel(ITestChannel channel)` – Adds a single channel to the selected list. - `void AddSelectedGroupChannels(string groupName, List channels)` – Adds a group of channels to the selected list. - `void AddLockedChannel(ITestChannel channel, bool isLocked)` – Adds a channel to the locked list; `isLocked` indicates lock status. - `void AddLockedGroupChannels(string testName, string groupName, List channels, bool isLocked)` – Adds a group of channels to the locked list. - `void GraphList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)` – Handles collection change events for the graph list. - **`IGraphChannelViewModel`** Manages channel selection and grouping for graphing. Inherits `IBaseViewModel`. - `IGraphChannelView View { get; }` - `ObservableCollection GraphChannelList { get; set; }` - `ObservableCollection SelectedGraphChannelList { get; set; }` - `TestChannel SelectedGraphChannel { get; set; }` - **`IGraphPropertyViewModel`** Manages property view. Inherits `IBaseViewModel`. - `IGraphPropertyView View { get; }` - **`IGraphViewModel`** Coordinates the main graph view and its data series view. Inherits `IBaseViewModel`. - `IGraphView View { get; }` - `ITestDataSeriesView DataSeriesView { get; set; }` - **`ITestDataViewModel`** Manages a single test data series view. Inherits `IBaseViewModel`. - `ITestDataView View { get; set; }` - `ITestDataSeries Model { get; set; }` - **`ITestDataSeriesViewModel`** Manages a single test data series view and cursor interaction. Inherits `IBaseViewModel`. - `ITestDataSeriesView View { get; set; }` - `ITestDataSeries Model { get; set; }` - `void MoveCursor(object sender, KeyEventArgs e)` – Handles cursor movement (e.g., keyboard navigation). - `string CurrentCursorValues { get; set; }` – Holds the current cursor position values (e.g., X/Y coordinates). ## 3. Invariants - All view interfaces (`IGraph*View`, `ITestData*View`) inherit `IBaseView`, implying a consistent base contract for UI components. - All view model interfaces (`IGraph*ViewModel`, `ITestData*ViewModel`) inherit `IBaseViewModel`, implying a consistent base contract for view models. - Each view model exposes a strongly-typed `View` property (e.g., `IGraphView`, `ITestDataSeriesView`)—ensuring one-to-one view/viewmodel pairing. - `ITestDataSeries` implements metadata properties (e.g., `TestGroup`, `ChannelName`, `EngineeringUnits`) and computed statistics (`MinY`, `MaxY`, `AvgY`, `StdDevY`, `PeakFrequency`, `PeakMagnitude`, `GRMS`)—some conditional on `FFT` or `PSD` mode. - `ITestDataSeries.FFT` indicates whether the series is frequency-domain data; `PeakFrequency` and `PeakMagnitude` are only populated when `FFT == true`. - `ITestDataSeries.HIC` is a boolean flag; `HICValue` is a string (likely formatted value). - `ITestDataSeries.GRMS` is only calculated in PSD results graphs (per documentation). - `ITestDataSeries.Description`, `SensorSNDisplay`, `MinY`, `MaxY`, `AvgY`, `StdDevY`, `T1Time`, `T2Time`, `RecordingMode` are read-only (`get;` only). - `ITestDataSeriesViewModel.MoveCursor` uses WPF’s `KeyEventArgs`, implying keyboard-based cursor interaction. ## 4. Dependencies ### Internal Dependencies - **`DTS.Common.Base`** – All interfaces depend on `IBaseView` and `IBaseViewModel` from this namespace. - **`DTS.Common.Events`** – `ITestDataSeriesView` depends on this (though no event types are used in the provided snippet). - **`DTS.Common.Classes.Viewer.TestMetadata`** – `IGraphChannelViewModel` depends on `TestChannel` (imported from this namespace). - **`System.Collections.Generic`**, **`System.Collections.ObjectModel`**, **`System.Collections.Specialized`**, **`System.Windows.Input`**, **`System.Windows.Media`** – Used for collections, commands, and UI types. ### External Dependencies - **WPF** – Indicated by use of `KeyEventArgs`, `ObservableCollection`, and `Brush`. - **Unknown types**: `ITestChannel`, `ITestDataSeries`, `TestChannel` — referenced but not defined in this module; must be defined elsewhere (likely in `DTS.Common.Classes.Viewer.TestMetadata` or similar). ## 5. Gotchas - **`IGraphView.SetGraphs(...)` is commented out** — The method signature exists only as a comment, suggesting incomplete or deprecated functionality. Do not assume this method is implemented or callable. - **`ITestDataSeries` metadata is mixed**: Some properties are read-only (`Description`, `SensorSNDisplay`, `MinY`, etc.), others are read-write (`TestGroup`, `ChannelName`, etc.). Ensure consumers respect mutability. - **`ITestDataSeriesViewModel.MoveCursor` uses WPF types** — This implies tight coupling to WPF; non-WPF UI implementations may require adaptation or stubbing. - **`ITestDataSeriesViewModel.CurrentCursorValues` is a string** — Its format is not specified; consumers must agree on parsing/formatting (e.g., `"X: 1.23, Y: 4.56"`). - **`ITestDataSeriesViewModel.Model` is of type `ITestDataSeries`** — The interface name matches the model type, but the property is named `Model`, not `TestDataSeries`. Ensure consistency in naming. - **Namespace consistency via `// ReSharper disable CheckNamespace`** — Indicates intentional namespace alignment across files; do not assume additional namespace nesting. - **No explicit validation or error handling** — Interfaces do not define exception behavior or validation rules; these are likely implementation-specific. - **`ITestDataSeriesView.SaveReportToPDF` and `SaveReportToCSV` return `bool`** — Success/failure semantics are not documented; callers must infer meaning (e.g., `true` = success, `false` = failure or cancellation). - **`IGraphMainViewModel` uses `List` for locked/selected lists** — Not thread-safe; concurrent modifications may cause issues if not externally synchronized. - **`LockedGroupName` and `TestName` parameters in `AddLockedGroupChannels`** — Ambiguity: `testName` is used in locked group context but `groupName` is used elsewhere for grouping; ensure naming consistency across consumers.