Files

172 lines
7.4 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/DTS.Viewer/ChartOptions/IChartOptionsView.cs
- Common/DTS.CommonCore/Interface/DTS.Viewer/ChartOptions/IChartOptionsViewModel.cs
- Common/DTS.CommonCore/Interface/DTS.Viewer/ChartOptions/IChartOptionsModel.cs
generated_at: "2026-04-16T12:25:32.635258+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a0d576d041a71e53"
---
# Documentation: Chart Options Interfaces
## 1. Purpose
This module defines the contract for chart configuration and visualization options within the DTS system. It provides three interfaces (`IChartOptionsView`, `IChartOptionsViewModel`, `IChartOptionsModel`) that follow an MVVM (Model-View-ViewModel) pattern to manage chart display settings including axis scaling, cursors, unit types, filtering, and export functionality. These interfaces enable decoupled communication between UI components and business logic for chart rendering.
---
## 2. Public Interface
### IChartOptionsView
**Namespace:** `DTS.Common.Interface`
A marker interface extending `IBaseView` with no additional members.
```csharp
public interface IChartOptionsView : IBaseView { }
```
---
### IChartOptionsViewModel
**Namespace:** `DTS.Common.Interface`
Extends `IBaseViewModel` and coordinates between the view and model for chart options.
| Member | Type | Description |
|--------|------|-------------|
| `View` | `IBaseView` | Gets or sets the Search View. |
| `Parent` | `IBaseViewModel` | Gets or sets the parent view model. |
| `Model` | `IChartOptionsModel` | Gets or sets the associated chart options model. |
| `ContextSearchRegion` | `object` | Gets or sets a context search region object. |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `PublishChanges` | `void PublishChanges()` | Publishes pending changes. |
| `ResetZoomMethod` | `void ResetZoomMethod()` | Resets the chart zoom. |
| `ResetTMethod` | `void ResetTMethod()` | Resets the time axis. |
| `SaveToPDFMethod` | `void SaveToPDFMethod()` | Saves the chart to PDF. |
| `ShowCusor` | `void ShowCusor(bool value)` | Shows or hides the cursor. |
| `ShowMinMaxCursor` | `void ShowMinMaxCursor(bool value)` | Shows or hides the min/max cursor. |
---
### IChartOptionsModel
**Namespace:** `DTS.Common.Interface`
Extends `IBaseModel` and holds all chart configuration state and commands.
**ADC/mV Display Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `SupportsADC` | `bool` | True if all channels support ADC. |
| `SupportsMV` | `bool` | True if all channels support mV. |
| `DisplayingVolts` | `bool` | Indicates if current mV option is for Volts or mV. |
| `MVOrV` | `string` | Returns "mV" or "V" depending on `DisplayingVolts` value. |
**Y-Axis Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `FullScaleValues` | `List<double>` | Available full scale values. |
| `SelectedFullScaleValue` | `double` | Currently selected full scale value. |
| `MinFixedY` | `double` | Minimum fixed Y value. |
| `MaxFixedY` | `double` | Maximum fixed Y value. |
| `LockedY` | `bool` | Indicates if Y-axis is locked. |
| `YRange` | `YRangeScaleEnum` | Y-axis range scale setting. |
| `UnitType` | `ChartUnitTypeEnum` | Chart unit type. |
| `UnitTypeDescription` | `string` | Description of the unit type (getter only). |
**Time Axis Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `MinFixedT` | `double` | Minimum fixed T value. |
| `MaxFixedT` | `double` | Maximum fixed T value. |
| `LockedT` | `bool` | Indicates if T-axis is locked. |
| `TimeUnitType` | `TimeUnitTypeEnum` | Time unit type setting. |
**Cursor Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ShowCursor` | `bool` | Indicates if cursor is shown. |
| `CurrentCursorValues` | `string` | Current cursor values as string. |
| `IsCursorsAvailable` | `bool` | Indicates if cursors are available. |
**Filter Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `Filter` | `FilterOptionEnum` | Filter option setting. |
| `SelectedFilter` | `IFilterClass` | Selected filter class instance. |
**Other Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `Parent` | `IChartOptionsViewModel` | Parent view model reference. |
| `CanPublishChanges` | `bool` | Indicates if changes can be published. |
| `ReadData` | `bool` | Indicates if data should be read. |
| `IsDigitalChannel` | `bool` | Indicates if channel is digital. |
| `DecimateData` | `bool` | Indicates if data should be decimated. |
| `WidthPoints` | `long` | Width points value. |
**Commands:**
| Property | Type | Description |
|----------|------|-------------|
| `ResetZoomCommand` | `DelegateCommand` | Command to reset zoom. |
| `ResetTCommand` | `DelegateCommand` | Command to reset time axis. |
| `SaveToPDFCommand` | `DelegateCommand` | Command to save to PDF. |
---
## 3. Invariants
1. **Namespace Mismatch:** All three interfaces are declared in `DTS.Common.Interface` namespace, despite the file path suggesting `DTS.Viewer.ChartOptions`. The `// ReSharper disable CheckNamespace` directive indicates this is intentional.
2. **MVVM Hierarchy:**
- `IChartOptionsView` must implement `IBaseView`
- `IChartOptionsViewModel` must implement `IBaseViewModel`
- `IChartOptionsModel` must implement `IBaseModel`
3. **Parent-Child Relationships:**
- `IChartOptionsModel.Parent` must reference the `IChartOptionsViewModel` that owns it
- `IChartOptionsViewModel.Model` must reference the `IChartOptionsModel` it manages
4. **Unit Display Logic:** `MVOrV` property return value is determined by `DisplayingVolts` state.
5. **Command Availability:** The model exposes commands as `DelegateCommand` (Prism), implying they follow the `ICommand` pattern with execute/can-execute semantics.
---
## 4. Dependencies
### This module depends on:
- `DTS.Common.Base` - Provides `IBaseView`, `IBaseViewModel`, `IBaseModel`
- `DTS.Common.Enums.Viewer` - Provides `YRangeScaleEnum`, `ChartUnitTypeEnum`, `TimeUnitTypeEnum`, `FilterOptionEnum`
- `DTS.Common.Interface.Sensors.SoftwareFilters` - Provides `IFilterClass`
- `Microsoft.Practices.Prism.Commands` - Provides `DelegateCommand`
- `System.Collections.Generic` - Provides `List<T>`
- `System.Windows.Input` - Provides `ICommand` (indirectly via `DelegateCommand`)
### What depends on this module:
- **Unclear from source alone** - No consumers are shown in these files. Likely implementations exist in a viewer/charting module.
---
## 5. Gotchas
1. **Typo in Method Name:** `ShowCusor(bool value)` is misspelled (should be `ShowCursor`). This typo is part of the public API and must be used as-is.
2. **Namespace/Path Inconsistency:** Files are located in `Common/DTS.CommonCore/Interface/DTS.Viewer/ChartOptions/` but declare namespace `DTS.Common.Interface`. The ReSharper suppression confirms this is deliberate but may cause confusion during navigation.
3. **Command vs Method Duplication:** `IChartOptionsModel` exposes `ResetZoomCommand`, `ResetTCommand`, `SaveToPDFCommand` while `IChartOptionsViewModel` exposes corresponding methods `ResetZoomMethod()`, `ResetTMethod()`, `SaveToPDFMethod()`. The relationship between these is not documented in the source.
4. **Mixed Naming Conventions:** Some methods use `Method` suffix (e.g., `ResetZoomMethod`) while properties use `Command` suffix (e.g., `ResetZoomCommand`). The rationale is unclear from source alone.