This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Model/TestDataSeries.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Model/TestDataSeriesModel.cs
generated_at: "2026-04-17T15:56:35.752282+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2fa01244d764d6f0"
---
# Documentation: DTS.Viewer.Graph Module - Test Data Series
## 1. Purpose
This module provides the data model and factory logic for rendering test channel data on graphs within the DTS Viewer application. `TestDataSeries` serves as the serializable, property-change-notifying data transfer object that holds channel metadata, time/frequency domain data, and computed statistics. `TestDataSeriesModel` acts as the factory that transforms raw `ITestChannel` binary data into `TestDataSeries` instances, handling time-domain, FFT, and PSD (Power Spectral Density) transformations with optional filtering and windowing.
---
## 2. Public Interface
### TestDataSeries Class
**Namespace:** `DTS.Viewer.Graph.Model`
**Inherits:** `Common.Base.BasePropertyChanged`
**Implements:** `ITestDataSeries`
#### Properties
| Property | Type | Description |
|----------|------|-------------|
| `HIC` | `bool` | Indicates if Head Injury Criteria data is present. |
| `HICValue` | `string` | Formatted HIC value. |
| `T1Time` / `T2Time` | `string` | T1/T2 timestamp strings for HIC calculations. |
| `TestGroup` | `string` | Test group identifier. |
| `TestId` | `string` | Unique test identifier. |
| `TestSetupName` | `string` | Name of the test setup configuration. |
| `ChannelId` | `string` | Channel identifier. |
| `Xvalue` | `double[]` | X-axis data array (time or frequency values). |
| `Yvalue` | `double[]` | Y-axis data array (amplitude values). |
| `GraphColor` | `Brush` | WPF brush for graph rendering. Getter creates new `SolidColorBrush` from internal `byte[]`. |
| `HardwareChannel` | `string` | Hardware channel name. |
| `Bridge` | `string` | Bridge type identifier. |
| `SWAAF` | `string` | Software anti-aliasing filter setting. |
| `HWAAF` | `string` | Hardware anti-aliasing filter rate. |
| `SampleRate` | `string` | Sample rate in Hz. |
| `RecordingMode` | `string` | Recording mode description. |
| `ISOCode` / `ISOChannelName` | `string` | ISO channel identification. |
| `UserCode` / `UserChannelName` | `string` | User-defined channel identification. |
| `ChannelName` | `string` | Display channel name. |
| `Description` | `string` | Channel description. |
| `SensorSN` | `string` | Sensor serial number. |
| `SensorSNDisplay` | `string` | Returns `Strings.Table_NA` if sensor is test-specific embedded, otherwise returns `SensorSN`. |
| `EngineeringUnits` | `string` | Engineering units string. |
| `Excitation` | `string` | Excitation voltage. |
| `Polarity` | `string` | Sensor polarity. |
| `MinY` / `MaxY` / `AvgY` / `StdDevY` | `string` | Statistical values, default to `Strings.Table_NA`. |
| `PeakMagnitude` | `double` | Peak magnitude of frequencies (valid only when `FFT` is true). |
| `PeakFrequency` | `double` | Frequency of highest magnitude (valid only when `FFT` is true). |
| `GRMS` | `double` | Root-mean-squared acceleration (calculated in PSD results). |
| `FFT` | `bool` | Indicates whether series is FFT-transformed data. |
| `T0EUValue` | `string` | T0 value regardless of units. |
| `IsSaved` | `bool` | Get-only property (purpose unclear from source). |
#### Methods
```csharp
public void SetStatsFromYValues()
```
Sets `AvgY`, `StdDevY`, `MinY`, `MaxY`, `T0EUValue` using internal `Yvalue` array. Formats using `"G5"` format string.
```csharp
public void SetStatsFromYValues(double[] values)
```
Overload that accepts an external `double[]` array. Handles null/empty arrays by setting all stats to `NaN` (displayed as `Strings.Table_NA`).
```csharp
public void SetStatsFromChannel(ITestChannel channel)
```
Sets statistics from pre-calculated values on an `ITestChannel` instance (`channel.MinY`, `channel.MaxY`, `channel.AveY`, `channel.StdDevY`, `channel.T0Value`).
---
### TestDataSeriesModel Class
**Namespace:** `DTS.Viewer.Graph`
**Implements:** `IBaseModel`
#### Properties
| Property | Type | Description |
|----------|------|-------------|
| `Parent` | `IGraphViewModel` | Parent view model reference. |
| `_eventAggregator` | `IEventAggregator` | Prism event aggregator for publishing progress events. |
| `ErrorMessage` | `string` | Error message with property change notification. |
| `IsSaved` | `bool` | Get-only property (purpose unclear from source). |
#### Methods
```csharp
public Task<ITestDataSeries> GetTestDataAsync(ITestChannel channel, IChartOptionsModel chartOptions, bool bVolts, IPSDReportSettingsModel psdSettings = null)
```
Async wrapper that calls synchronous `GetTestData`. Returns a single `ITestDataSeries`.
```csharp
public Task<List<ITestDataSeries>> GetTestDataAsync(List<ITestChannel> channels, IChartOptionsModel chartOptions, bool bVolts, IPSDReportSettingsModel psdSettings = null)
```
Async wrapper for batch channel processing. If `psdSettings.ShowEnvelope` is true, appends an envelope channel to results.
```csharp
public List<ITestDataSeries> GetTestData(List<ITestChannel> channels, IChartOptionsModel chartOptions, bool bVolts, IPSDReportSettingsModel psdSettings = null)
```
Synchronous batch processing. Catches `OutOfDataException` and re-throws with sample index context.
```csharp
public ITestDataSeries GetTestData(ITestChannel channel, IChartOptionsModel chartOptions, bool bVolts, IPSDReportSettingsModel psdSettings = null)
```
Entry point for single channel processing, delegates to `AddTestChannelToChart`.
```csharp
public TestDataSeries AddTestChannelToChart(ITestChannel channel, IChartOptionsModel chartOptions, bool bVolts, IPSDReportSettingsModel psdSettings = null)
```
**Primary factory method.** Reads binary channel data via `Serialization.SliceRaw.File.Reader.ReadChannelsBinaryData`, then:
- For **FFT mode** (`chartOptions.UnitType == FFT` and no PSD settings): Sets `FFT=true`, populates `PeakFrequency`, `PeakMagnitude`, `Xvalue`, `Yvalue`.
- For **regular time-domain**: Calculates time axis with unit conversion (ms or s), handles HIC data if present, sets stats from channel.
- For **PSD mode**: Applies data range selection, resizes to power-of-2 length, applies optional low-pass/high-pass filters, computes PSD via `FftSharp.Transform.PSD_Welch`, calculates GRMS.
Returns `null` if `channel.ErrorMessage` is not empty.
```csharp
private ITestDataSeries GetEnvelopeChannel(List<ITestDataSeries> data)
```
Creates an envelope channel by taking the maximum Y value at each frequency across all input series. Sets `ChannelId` and related fields to `Strings.EnvelopeUnique`.
```csharp
private double CalculateGRMS(double[] freq, double[] psd)
```
Calculates Grms using numerical integration of PSD curve. Handles logarithmic slope calculation with special case for N=-1.
---
## 3. Invariants
1. **Array Initialization**: `Xvalue` and `Yvalue` are initialized to empty arrays (`new double[0]`), never null.
2. **GraphColor Thread Safety**: `GraphColor` getter always creates a new `SolidColorBrush` instance; internal storage is `byte[] _graphColorARGB` to ensure thread safety (per comment referencing issue 34455).
3. **FFT/PSD Filter Bypass**: When `chartOptions.UnitType` is `FFT` or `PSD`, `channel.SoftwareFilter` is forcibly set to `"none"` before reading data.
4. **Statistics Format**: All statistical string properties use `"G5"` format specifier via `STAT_FORMAT` constant.
5. **PSD Data Length**: PSD processing resizes input arrays to the next enclosing power of 2 via `Utils.GetEnclosingPower2`.
6. **Frequency Array First Element**: In PSD processing, `freq[0]` is explicitly set to `1` after calculation.
7. **SensorSNDisplay Logic**: Returns `Strings.Table_NA` when `SensorConstants.IsTestSpecificEmbedded(SensorSN)` returns true.
---
## 4. Dependencies
### Imports (What this module depends on):
**TestDataSeries.cs:**
- `DTS.Common.Enums.Sensors` - `SensorConstants` for embedded sensor detection
- `DTS.Common.Interface` - `ITestDataSeries` interface
- `DTS.Common.Strings` - Localized string constants
- `System.Windows.Media` - WPF `Brush

View File

@@ -0,0 +1,207 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Properties/AssemblyInfo.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Properties/Annotations.cs
generated_at: "2026-04-17T15:56:49.185438+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "88f7afb7b05c4748"
---
# Documentation: DTS.Viewer.Graph Properties
## 1. Purpose
This module provides assembly metadata and JetBrains ReSharper code analysis annotations for the `DTS.Viewer.Graph` component within the DTS Viewer application. The `AssemblyInfo.cs` file defines standard .NET assembly attributes including versioning, copyright, and COM visibility settings. The `Annotations.cs` file contains a comprehensive set of custom attributes (sourced from JetBrains under MIT license) that enable enhanced static code analysis, nullability checking, and IDE assistance within the `DTS.Viewer.Graph.Annotations` namespace. These annotations have no runtime behavior but improve developer experience through compile-time hints and warnings.
## 2. Public Interface
### AssemblyInfo.cs - Assembly Attributes
| Attribute | Value |
|-----------|-------|
| `AssemblyTitle` | "Graph" |
| `AssemblyDescription` | "" (empty) |
| `AssemblyCompany` | "" (empty) |
| `AssemblyProduct` | "Graph" |
| `AssemblyCopyright` | "Copyright © 2017" |
| `ComVisible` | `false` |
| `Guid` | "61261c58-c32e-4dea-a87a-d7f956f28b4d" |
| `AssemblyVersion` | "1.0.0.0" |
| `AssemblyFileVersion` | "1.0.0.0" |
### Annotations.cs - Nullability Attributes
- **`CanBeNullAttribute`** - Indicates the marked element's value may be `null`. Applicable to methods, parameters, properties, delegates, fields, events, classes, interfaces, and generic parameters.
- **`NotNullAttribute`** - Indicates the marked element's value will never be `null`. Same applicability as `CanBeNullAttribute`.
- **`ItemNotNullAttribute`** - For `IEnumerable`, `Task`, or `Lazy` types, indicates collection items, `Task.Result`, or `Lazy.Value` are never `null`.
- **`ItemCanBeNullAttribute`** - For `IEnumerable`, `Task`, or `Lazy` types, indicates collection items, `Task.Result`, or `Lazy.Value` may be `null`.
### Annotations.cs - String Formatting Attributes
- **`StringFormatMethodAttribute(string formatParameterName)`** - Marks a method as using a format string pattern. Constructor takes the parameter name containing the format string.
- **`ValueProviderAttribute(string name)`** - Indicates a parameter accepts values from a limited set. Constructor takes the provider name.
### Annotations.cs - Property Change Notification
- **`NotifyPropertyChangedInvocatorAttribute`** - Marks methods used to notify property changes in `INotifyPropertyChanged` implementations. Optional constructor takes `parameterName` (string).
### Annotations.cs - Contract Annotations
- **`ContractAnnotationAttribute(string contract, bool forceFullStates = false)`** - Describes method input/output dependencies using Function Definition Table syntax. Properties: `Contract` (string), `ForceFullStates` (bool).
### Annotations.cs - Usage Annotations
- **`UsedImplicitlyAttribute`** - Marks symbols used implicitly (reflection, external libraries). Constructors accept `ImplicitUseKindFlags` and/or `ImplicitUseTargetFlags`.
- **`MeansImplicitUseAttribute`** - Applied to attributes to prevent marking decorated symbols as unused.
- **`PublicAPIAttribute`** - Marks publicly available API that should not be removed. Optional constructor takes `comment` (string).
### Annotations.cs - Method Behavior Attributes
- **`PureAttribute`** - Indicates a method makes no observable state changes.
- **`MustUseReturnValueAttribute`** - Indicates the return value must be used. Optional constructor takes `justification` (string).
- **`InstantHandleAttribute`** - Indicates a parameter is fully handled during method execution (delegates executed, enumerables enumerated).
- **`LinqTunnelAttribute`** - Marks pure LINQ methods with postponed enumeration.
- **`NoEnumerationAttribute`** - Indicates an `IEnumerable` parameter is not enumerated.
- **`TerminatesProgramAttribute`** - **[Obsolete]** Use `[ContractAnnotation("=> halt")]` instead.
### Annotations.cs - Assertion Attributes
- **`AssertionMethodAttribute`** - Marks a method as an assertion method.
- **`AssertionConditionAttribute(AssertionConditionType conditionType)`** - Marks the condition parameter of an assertion method.
- **`AssertionConditionType`** (enum) - Values: `IS_TRUE` (0), `IS_FALSE` (1), `IS_NULL` (2), `IS_NOT_NULL` (3).
### Annotations.cs - Collection Attributes
- **`CollectionAccessAttribute(CollectionAccessType collectionAccessType)`** - Describes how a method affects collection content.
- **`CollectionAccessType`** (flags enum) - Values: `None` (0), `Read` (1), `ModifyExistingContent` (2), `UpdatedContent` (6).
### Annotations.cs - Implicit Use Enums
- **`ImplicitUseKindFlags`** (flags enum) - Values: `Default`, `Access` (1), `Assign` (2), `InstantiatedWithFixedConstructorSignature` (4), `InstantiatedNoFixedConstructorSignature` (8).
- **`ImplicitUseTargetFlags`** (flags enum) - Values: `Default`, `Itself` (1), `Members` (2), `WithMembers` (3).
### Annotations.cs - ASP.NET MVC Attributes
- **`AspMvcActionAttribute`** - Marks MVC action parameters/methods. Optional constructor takes `anonymousProperty` (string).
- **`AspMvcAreaAttribute`** - Marks MVC area parameters.
- **`AspMvcControllerAttribute`** - Marks MVC controller parameters/methods.
- **`AspMvcMasterAttribute`** - Marks MVC Master parameters.
- **`AspMvcModelTypeAttribute`** - Marks MVC model type parameters.
- **`AspMvcPartialViewAttribute`** - Marks MVC partial view parameters/methods.
- **`AspMvcViewAttribute`** - Marks MVC view component parameters/methods.
- **`AspMvcViewComponentAttribute`** - Marks MVC view component name parameters.
- **`AspMvcViewComponentViewAttribute`** - Marks MVC view component view parameters/methods.
- **`AspMvcActionSelectorAttribute`** - Marks MVC action name parameters in attributes.
- **`AspMvcSuppressViewErrorAttribute`** - Disables MVC view inspections for a class/method.
- **`AspMvcDisplayTemplateAttribute`** - Marks MVC display template parameters.
- **`AspMvcEditorTemplateAttribute`** - Marks MVC editor template parameters.
- **`AspMvcTemplateAttribute`** - Marks MVC template parameters.
### Annotations.cs - ASP.NET MVC Location Format Attributes
- **`AspMvcAreaMasterLocationFormatAttribute(string format)`**
- **`AspMvcAreaPartialViewLocationFormatAttribute(string format)`**
- **`AspMvcAreaViewLocationFormatAttribute(string format)`**
- **`AspMvcMasterLocationFormatAttribute(string format)`**
- **`AspMvcPartialViewLocationFormatAttribute(string format)`**
- **`AspMvcViewLocationFormatAttribute(string format)`**
### Annotations.cs - ASP.NET Control Attributes
- **`AspChildControlTypeAttribute(string tagName, Type controlType)`**
- **`AspDataFieldAttribute`**
- **`AspDataFieldsAttribute`**
- **`AspMethodPropertyAttribute`**
- **`AspRequiredAttributeAttribute(string attribute)`**
- **`AspTypePropertyAttribute(bool createConstructorReferences)`**
### Annotations.cs - Razor Attributes
- **`RazorSectionAttribute`** - Marks Razor section parameters/methods.
- **`RazorImportNamespaceAttribute(string name)`** - Assembly-level, multiple allowed.
- **`RazorInjectionAttribute(string type, string fieldName)`** - Assembly-level, multiple allowed.
- **`RazorDirectiveAttribute(string directive)`** - Assembly-level, multiple allowed.
- **`RazorHelperCommonAttribute`** - Method-level.
- **`RazorLayoutAttribute`** - Property-level.
- **`RazorWriteLiteralMethodAttribute`** - Method-level.
- **`RazorWriteMethodAttribute`** - Method-level.
- **`RazorWriteMethodParameterAttribute`** - Parameter-level.
### Annotations.cs - HTML Attributes
- **`HtmlElementAttributesAttribute`** - Optional constructor takes `name` (string).
- **`HtmlAttributeValueAttribute(string name)`**
### Annotations.cs - XAML Attributes
- **`XamlItemsControlAttribute`** - Marks types with `ItemsSource` property.
- **`XamlItemBindingOfItemsControlAttribute`** - Marks `BindingBase`-derived properties.
### Annotations.cs - Other Attributes
- **`LocalizationRequiredAttribute(bool required = true)`** - Indicates localization requirements.
- **`CannotApplyEqualityOperatorAttribute`** - Disallows `==`/`!=` operators (except with `null`).
- **`BaseTypeRequiredAttribute(Type baseType)`** - Applied to attributes to require implementers to inherit/implement a type.
- **`ProvidesContextAttribute`** - Indicates a context value provider.
- **`PathReferenceAttribute`** - Marks file/folder path parameters. Optional constructor takes `basePath` (string).
- **`SourceTemplateAttribute`** - Marks extension methods as source templates.
- **`MacroAttribute`** - Specifies macros for source template parameters. Properties: `Expression` (string), `Editable` (int), `Target` (string).
- **`RegexPatternAttribute`** - Marks regex pattern parameters.
- **`NoReorderAttribute`** - Prevents member reordering in the marked type.
## 3. Invariants
- **Assembly Versioning**: Both `AssemblyVersion` and `AssemblyFileVersion` are fixed at "1.0.0.0".
- **COM Visibility**: `ComVisible` is `false`, making types invisible to COM components by default.
- **Namespace Consistency**: All annotation attributes reside in `DTS.Viewer.Graph.Annotations` namespace.
- **Attribute Usage Constraints**: Each attribute has specific `AttributeUsage` constraints defining valid targets (method, parameter, property, etc.).
- **License Requirement**: The `Annotations.cs` file is MIT licensed from JetBrains; the copyright notice must be preserved in copies.
## 4. Dependencies
### Imports (AssemblyInfo.cs)
- `System.Reflection`
- `System.Runtime.CompilerServices`
- `System.Runtime.InteropServices`
### Imports (Annotations.cs)
- `System`
### Downstream Dependencies
- **Unclear from source alone** - The annotation attributes are designed for consumption by JetBrains ReSharper and Rider IDEs. The `DTS.Viewer.Graph` assembly likely contains graph-related functionality used by other modules in the DTS Viewer application, but the actual consumers cannot be determined from these files alone.
## 5. Gotchas
- **`TerminatesProgramAttribute` is Obsolete**: This attribute is marked `[Obsolete]` with guidance to use `[ContractAnnotation("=> halt")]` instead. New code should not use it.
- **Annotations are Compile-Time Only**: All attributes in `Annotations.cs` are for static analysis only. They have no runtime behavior and will not affect execution.
- **Pragma Warnings Disabled**: The `Annotations.cs` file disables warning 1591 (missing XML documentation) and includes multiple ReSharper directive disables at the file level.
- **Empty Assembly Metadata**: Several assembly attributes (`AssemblyDescription`, `AssemblyConfiguration`, `AssemblyCompany`) are empty strings, which may indicate incomplete configuration.
- **Hardcoded Copyright Year**: The copyright is hardcoded to 2017; this may need updating for newer releases.

View File

@@ -0,0 +1,25 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Resources/TranslateExtension.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/Resources/StringResources.Designer.cs
generated_at: "2026-04-17T16:11:57.317533+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "324d8a7946627095"
---
# Resources
### Purpose
This module provides localization support for the Graph module through a XAML markup extension and strongly-typed resource access. It follows the same pattern as the ViewerSettings/Resources module but contains graph-specific localized strings for error messages, status messages, and save operation feedback related to chart and report operations.
### Public Interface
**TranslateExtension** (inherits `MarkupExtension`)
- `TranslateExtension(string key)` - Constructor accepting the resource key to look up.
- `ProvideValue(IServiceProvider serviceProvider)` - Returns the localized string from `StringResources.ResourceManager.GetString(_key)`. Returns `"#stringnotfound#"` if key is null/empty, or `"#stringnotfound# " + _key` if the key is not found in resources.
**StringResources** (auto-generated)
- `ResourceManager` - Static property returning the cached `ResourceManager` instance for the `"DTS.Viewer.Graph.Resources.StringResources"` resource name.
- `Culture` - Static property for getting/setting the `CultureInfo` for resource lookups.
- `BadDataFromCustomFilter` - Error message for custom filter frequency out of bounds (includes format placeholders `{0}`, `{1}`

View File

@@ -0,0 +1,61 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/View/GraphView.xaml.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/View/TestDataView.xaml.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/View/TestDataSeriesView.xaml.cs
generated_at: "2026-04-17T15:54:31.440283+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "00811c8a21090fcd"
---
# Documentation: DTS.Viewer.Graph Views
## 1. Purpose
This module provides WPF view components for graph and chart visualization within the DTS Viewer application. It contains three partial classes—`GraphView`, `TestDataView`, and `TestDataSeriesView`—that serve as code-behind files for their respective XAML views. These views implement interfaces from `DTS.Common.Interface` and provide chart rendering, user interaction handling, and export functionality (PDF and CSV) for test data series visualization.
---
## 2. Public Interface
### GraphView
**Signature:** `public partial class GraphView : IGraphView`
- **`GraphView()`** - Constructor. Calls `InitializeComponent()` to load the XAML-defined UI.
---
### TestDataView
**Signature:** `public partial class TestDataView : ITestDataView`
- **`TestDataView()`** - Constructor. Calls `InitializeComponent()` to load the XAML-defined UI.
---
### TestDataSeriesView
**Signature:** `public partial class TestDataSeriesView : ITestDataSeriesView`
- **`TestDataSeriesView()`** - Constructor. Calls `InitializeComponent()` to load the XAML-defined UI.
- **`bool SaveReportToPDF(string directory)`** - Generates a PDF report containing the chart image and a gRMS data table. Returns `true` on success, `false` on failure. Creates the directory if it does not exist. Logs success/failure via `APILogger`.
- **`bool SaveReportToCSV(string directory)`** - Exports chart data to a CSV file with frequency and PSD values. Returns `true` on success, `false` on failure. Creates the directory if it does not exist. Logs success/failure via `APILogger`.
---
### AxisExtension (Static Class)
**Signature:** `public static class AxisExtension`
- **`double GetDispMin(this Axis axis)`** - Extension method that calculates the displayed minimum value based on `ActualMin`, `ActualMax`, `Value`, and `Scale` properties.
- **`double GetDispMax(this Axis axis)`** - Extension method that calculates the displayed maximum value based on `ActualMin`, `ActualMax`, `Value`, and `Scale` properties.
---
## 3. Invariants
- **`SaveReportToPDF`**: The `directory` parameter must not be null, empty, or whitespace; otherwise, a `DirectoryNotFoundException` is thrown.
- **`SaveReportToPDF`**: `MainChart.DataContext` must be castable to `TestDataSeriesViewModel`; a direct cast is performed without null checking.
- **`SaveReportToPDF`**: `GraphDataSeries` must contain at least one element (accesses `dataSeries[0]` for test setup name and test ID).
- **`SaveReportToCSV`**: All data series in `GraphDataSeries` must have `Xvalue` and `Yvalue` arrays of equal or greater length than

View File

@@ -0,0 +1,36 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.Graph/ViewModel/GraphViewModel.cs
generated_at: "2026-04-17T15:54:22.914651+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "469500f219f64049"
---
# GraphViewModel Documentation
## 1. Purpose
`GraphViewModel` is a Prism-based MVVM ViewModel that manages graph visualization within the DTS Viewer application. It serves as a coordinator between parent views (`IViewerMainViewModel` or `IPSDReportMainViewModel`), child views (`ITestDataSeriesView`), and the event aggregation system. The class handles channel selection state, displays progress indicators during data loading operations, and manages UI visibility states for messaging and graph display regions.
---
## 2. Public Interface
### Constructor
```csharp
public GraphViewModel(IGraphView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
```
Initializes the ViewModel, sets the View's DataContext to itself, and creates `NotificationRequest` and `ConfirmationRequest` instances.
### Properties
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `View` | `IGraphView` | get; private set; | The associated graph view interface. |
| `Parent` | `IBaseViewModel` | internal get; set; | Reference to the parent ViewModel. |
| `DataSeriesView` | `ITestDataSeriesView` | get; set; | The data series view associated with this graph. |
| `NotificationRequest` | `InteractionRequest<Notification>` | get; private set; | Used to raise notification dialogs. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | get; private set; | Used to raise confirmation dialogs. |
| `ContextGraphRegion` | `object` | get; set; | Wraps `((GraphView)View).GraphRegion.Content` with property change notification. |
|