--- 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-16T02:34:12.071463+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "a0d576d041a71e53" --- # ChartOptions ## Documentation Page: Chart Options Module ### 1. Purpose This module defines the core interfaces for the chart options UI layer in the DTS Viewer subsystem. It establishes the MVVM (Model-View-ViewModel) contract for configuring chart display parameters—such as timebase, voltage range, filtering, cursor visibility, and data export—within a charting context. The interfaces `IChartOptionsView`, `IChartOptionsViewModel`, and `IChartOptionsModel` collectively enable separation of concerns between UI presentation, state management, and business logic, supporting features like zoom/t-scale resets, PDF export, and dynamic unit display (e.g., V vs. mV). --- ### 2. Public Interface #### `IChartOptionsView` - **Inherits**: `IBaseView` - **Description**: Marker interface for the view (UI) component of the chart options panel. No additional members beyond base view contract. #### `IChartOptionsViewModel` - **Inherits**: `IBaseViewModel` - **Properties**: - `IBaseView View { get; set; }` – Reference to the associated view instance. - `IBaseViewModel Parent { get; set; }` – Reference to the parent view model (e.g., main chart view model). - `IChartOptionsModel Model { get; set; }` – Reference to the underlying data model. - `object ContextSearchRegion { get; set; }` – Context object for search/region operations (type not specified; likely used for interop or region selection). - **Methods**: - `void PublishChanges()` – Commits pending configuration changes (e.g., updated filters, scale, units). - `void ResetZoomMethod()` – Resets Y-axis zoom to default/full scale. - `void ResetTMethod()` – Resets T-axis (timebase) zoom/limits to default. - `void SaveToPDFMethod()` – Triggers export of the current chart view to PDF. - `void ShowCusor(bool value)` – Controls visibility of the primary cursor (note: typo in method name—`Cusor` instead of `Cursor`). - `void ShowMinMaxCursor(bool value)` – Controls visibility of min/max cursor indicators. #### `IChartOptionsModel` - **Inherits**: `IBaseModel` - **Properties**: - `bool SupportsADC { get; set; }` – True if all channels support analog-to-digital conversion. - `bool SupportsMV { get; set; }` – True if all channels support millivolt measurements. - `bool DisplayingVolts { get; set; }` – True if units are displayed in Volts; false implies mV. - `string MVOrV { get; }` – Returns `"V"` or `"mV"` based on `DisplayingVolts`. - `List FullScaleValues { get; set; }` – Available full-scale range options (e.g., [1, 5, 10] for Volts). - `double SelectedFullScaleValue { get; set; }` – Currently selected full-scale value. - `double MinFixedY { get; set; }` / `MaxFixedY { get; set; }` – Fixed Y-axis range limits. - `double MinFixedT { get; set; }` / `MaxFixedT { get; set; }` – Fixed T-axis (time) range limits. - `bool LockedT { get; set; }` – True if T-axis range is locked (immutable). - `bool LockedY { get; set; }` – True if Y-axis range is locked. - `bool ShowCursor { get; set; }` – Controls primary cursor visibility. - `string CurrentCursorValues { get; set; }` – String representation of current cursor positions (e.g., "t=1.23s, y=4.56mV"). - `YRangeScaleEnum YRange { get; set; }` – Enumerated Y-axis scaling mode (e.g., Auto, Fixed, Full). - `ChartUnitTypeEnum UnitType { get; set; }` – Enumerated unit type for Y-axis (e.g., Voltage, Current). - `TimeUnitTypeEnum TimeUnitType { get; set; }` – Enumerated unit type for T-axis (e.g., Seconds, Milliseconds). - `string UnitTypeDescription { get; }` – Human-readable description of `UnitType` (e.g., "Voltage (mV)"). - `FilterOptionEnum Filter { get; set; }` – Selected filter option (e.g., None, Lowpass, Highpass). - `IFilterClass SelectedFilter { get; set; }` – Concrete filter instance corresponding to `Filter`. - `bool IsCursorsAvailable { get; set; }` – True if cursor functionality is enabled for the current chart. - `bool CanPublishChanges { get; set; }` – Indicates whether `PublishChanges()` should be allowed (e.g., after validation). - `bool ReadData { get; set; }` – Controls whether live data acquisition is active. - `bool IsDigitalChannel { get; set; }` – True if the chart displays digital (logic) channel data. - `bool DecimateData { get; set; }` – True if data decimation is applied for performance. - `long WidthPoints { get; set; }` – Number of data points displayed horizontally (resolution). - **Commands (Prism `DelegateCommand`)**: - `DelegateCommand ResetZoomCommand { get; }` – Binds to `ResetZoomMethod()` (via ViewModel). - `DelegateCommand ResetTCommand { get; }` – Binds to `ResetTMethod()` (via ViewModel). - `DelegateCommand SaveToPDFCommand { get; }` – Binds to `SaveToPDFMethod()` (via ViewModel). - **Relationships**: - `IChartOptionsViewModel Parent { get; set; }` – Back-reference to the owning view model. --- ### 3. Invariants - `IChartOptionsModel.MVOrV` is derived from `DisplayingVolts` and must return `"V"` when `DisplayingVolts == true`, otherwise `"mV"`. - `IChartOptionsModel.UnitTypeDescription` is derived from `UnitType` and must reflect the current unit type’s human-readable form. - `IChartOptionsModel.Filter` and `SelectedFilter` must be kept in sync: setting `Filter` should update `SelectedFilter` to a corresponding `IFilterClass` instance. - `IChartOptionsModel.IsCursorsAvailable` must be `false` for digital channels (`IsDigitalChannel == true`), as cursors are typically analog-only. - `IChartOptionsModel.LockedT` and `LockedY` imply that `MinFixedT/MaxFixedT` and `MinFixedY/MaxFixedY` are immutable during the lock period. - `IChartOptionsViewModel.Model` must be non-null and consistent with `IChartOptionsModel.Parent`. --- ### 4. Dependencies - **Dependencies *of* this module**: - `DTS.Common.Base` (provides `IBaseView`, `IBaseViewModel`, `IBaseModel`). - `DTS.Common.Enums.Viewer` (provides `YRangeScaleEnum`, `ChartUnitTypeEnum`, `TimeUnitTypeEnum`). - `DTS.Common.Interface.Sensors.SoftwareFilters` (provides `IFilterClass`). - `Microsoft.Practices.Prism.Commands` (provides `DelegateCommand`). - **Dependencies *on* this module**: - Any charting UI component requiring configuration (e.g., `IChartView`/`IChartViewModel`) likely consumes `IChartOptionsViewModel` and/or `IChartOptionsModel`. - Data acquisition or rendering logic may depend on `IChartOptionsModel` properties (e.g., `DecimateData`, `ReadData`, `SelectedFilter`). --- ### 5. Gotchas - **Typo in method name**: `ShowCusor(bool)` (should be `ShowCursor`). This is consistent across the source and likely reflects legacy naming. - **Ambiguous `ContextSearchRegion`**: Type is `object` with no documentation—consumers must infer contract (e.g., likely expects a region object from a parent view model or chart control). - **`MVOrV` and `UnitTypeDescription` are read-only**: Their values are computed from other properties; direct assignment is impossible. - **`SelectedFilter` is of type `IFilterClass`**: Implementation must ensure the selected filter instance matches the `Filter` enum value (per comment: "FB 13120 Updated to use IFilterClass"). - **No validation rules exposed**: `CanPublishChanges` is a boolean flag but its update logic (e.g., when it becomes `true`) is not defined in this interface. - **No thread-safety guarantees**: All methods/properties assume single-threaded access (common in WPF MVVM but not explicit here). - **None identified from source alone** for digital channel behavior beyond `IsCursorsAvailable`.