Files

69 lines
5.4 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/TimeUnitType.cs
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/FilterOption.cs
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/YRangeScale.cs
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/WakeMethodType.cs
- Common/DTS.Common/Enums/DTS.Viewer/ChartOptions/ChartUnitType.cs
generated_at: "2026-04-16T03:22:06.280473+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "01cac2bfa9823a62"
---
# ChartOptions
## Documentation: Chart Configuration Enums Module
### 1. Purpose
This module defines a set of strongly-typed enumerations and associated `IItemsSource` implementations used to configure chart display and behavior in the DTS Viewer application. These enums standardize user-facing options for time units, filtering, Y-axis scaling, wake methods, and chart units—ensuring consistency across UI components (e.g., property grids) and backend logic that consumes these configuration values. All enums are decorated with `[Description]` attributes for localized display text and use a custom `EnumDescriptionTypeConverter` to support UI binding.
### 2. Public Interface
#### Enums (all in `DTS.Common.Enums.Viewer` namespace)
| Enum | Members & Descriptions |
|------|------------------------|
| `TimeUnitTypeEnum` | `MS = 0` ("ms"), `Seconds = 1` ("Seconds") — Time unit for chart X-axis. |
| `FilterOptionEnum` | `Unfiltered = 0` ("Unfiltered"), `TestSetupDefault = 1` ("Test Setup Default"), `Custom = 2` ("Custom") — Filter mode selection for chart data. |
| `YRangeScaleEnum` | `AutoRange = 0` ("Auto Range"), `FullScale = 1` ("% Full Scale"), `Fixed = 2` ("Fixed"), `Manual = 3` ("Manual") — Y-axis scaling strategy. |
| `WakeMethodTypeEnum` | `None = 0` ("None"), `MotionDetect = 1` ("Motion detect"), `TimeSession = 2` ("Time session"), `Magnet = 3` ("Magnet") — Device wake-up trigger method. |
| `ChartUnitTypeEnum` | `EU = 0` ("EU"), `mV = 1` ("mV"), `ADC = 2` ("ADC"), `FFT = 3` ("FFT"), `PSD = 4` ("PSD") — Unit type for chart Y-axis values. |
#### Item Source Classes (used for UI binding, e.g., property grids)
| Class | Method | Behavior |
|-------|--------|----------|
| `TimeUnitTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `TimeUnitTypeEnum` values via `EnumUtil.GetValuesList<TimeUnitTypeEnum>()`. |
| `FilterOptionEnumItemSource` | `ItemCollection GetValues()` | Returns a list of all `FilterOptionEnum` values. |
| `YRangeScaleItemSource` | `ItemCollection GetValues()` | Returns a list of all `YRangeScaleEnum` values. |
| `WakeMethodTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `WakeMethodTypeEnum` values. |
| `ChartUnitTypeItemSource` | `ItemCollection GetValues()` | Returns a list of all `ChartUnitTypeEnum` values. |
### 3. Invariants
- All enum values are explicitly assigned integer constants starting from `0` and incrementing by `1`.
- Each enum member has a `[Description]` attribute with a non-empty string; no member lacks a description.
- The `GetValues()` methods in all `IItemsSource` implementations are pure and idempotent—repeated calls return equivalent `ItemCollection` instances.
- Enums are strictly for *configuration metadata*; no business logic is embedded in these types.
- The `EnumDescriptionTypeConverter` is assumed to map enum values to their `[Description]` attribute values for display (not verified in source, but implied by usage).
### 4. Dependencies
**Dependencies *of* this module:**
- `System.ComponentModel` (for `DescriptionAttribute`)
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter)
- `DTS.Common.Utils.EnumUtil` (provides `GetValuesList<T>()`)
- `Xceed.Wpf.Toolkit.PropertyGrid.Attributes.IItemsSource` (WPF Toolkit interface for property grid item sources)
**Dependencies *on* this module:**
- UI components (e.g., WPF property grids) that bind to these enums via `IItemsSource` implementations.
- Any code that consumes chart configuration state (e.g., chart rendering logic, session configuration serializers) likely references these enums.
- *Inferred*: `EnumDescriptionTypeConverter` and `EnumUtil` are internal to `DTS.Common`; this module is part of the `DTS.Common` library.
### 5. Gotchas
- **No validation or range checks** are present in the enums themselves—consumers must enforce valid combinations (e.g., `FFT`/`PSD` units may only be valid for specific chart types).
- **Historical comments** in `ChartUnitTypeEnum` reference issue numbers (`//6402`, `//25554`), indicating incomplete features (FFT live switch, PSD implementation). These may affect runtime behavior if used prematurely.
- **Case sensitivity**: The `mV` member uses lowercase `v` (not `MV`), which may conflict with conventions (e.g., SI unit standards).
- **No deprecation markers**: Older enum values (e.g., `TimeSession` vs. newer wake methods) lack `[Obsolete]` attributes despite potential obsolescence.
- **No documentation on default values**: It is unclear which enum value is used as default in UI or configuration (e.g., `Unfiltered` for `FilterOptionEnum`? `AutoRange` for `YRangeScaleEnum`?).
- **No cross-enum constraints**: E.g., `Manual` Y-axis scaling may require additional parameters (not defined here), but the enum alone does not enforce this.
- **None identified from source alone.** (Note: The above are *inferred* from code structure and comments, but not explicitly stated in the source.)