Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions.md

86 lines
6.8 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ResetZoomChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorShowChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorsClearChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorShowMinMaxChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/CursorsAlailableChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/SaveToPDFRequestedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ChartAxisChangedEvent.cs
- Common/DTS.Common/Events/DTS.Viewer/ViewerChartOptions/ChartOptionsChangedEvent.cs
generated_at: "2026-04-16T03:26:50.843144+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "31b0212fbe1dea4d"
---
# ViewerChartOptions
## Documentation: Viewer Chart Options Events
### 1. Purpose
This module defines a set of Prism `PubSubEvent`-based events used to communicate state changes and user requests related to chart visualization options in the DTS Viewer component. These events decouple chart UI controls (e.g., zoom, cursor, axis, export) from the underlying view models and chart rendering logic, enabling loose coupling and event-driven updates across the application. All events reside in the `DTS.Common.Events` namespace and are part of the shared `DTS.Common` library.
---
### 2. Public Interface
| Event Class | Payload Type | Behavior |
|-------------|--------------|----------|
| `ResetZoomChangedEvent` | `bool` | Published when the reset-zoom option state changes (e.g., enabled/disabled). *Note: XML comment incorrectly states “The Data Folder changed event.”* |
| `CursorShowChangedEvent` | `bool` | Published when the visibility state of the primary cursor changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
| `CursorsClearChangedEvent` | `bool` | Published when the state of the “clear cursors” option changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
| `CursorShowMinMaxChangedEvent` | `bool` | Published when the option to show min/max values for cursors changes. *Note: XML comment incorrectly states “The Data Folder changed event.”* |
| `CursorsAlailableChangedEvent` | `bool` | Published when the availability (e.g., enabled/disabled) of cursor functionality changes. *Note: Typo in class name (`Alailable` instead of `Available`); XML comment incorrectly states “The Data Folder changed event.”* |
| `SaveToPDFRequestedEvent` | `string` | Published when the user requests saving the current chart to PDF. The payload is a string—likely a suggested file path or filename. |
| `ChartAxisChangedEvent` | `ChartAxisChangedEventArg` | Published when chart axis ranges are modified. Payload contains the parent view model, axis identifier, and min/max values. |
| `ChartOptionsChangedEvent` | `ChartOptionsChangedEventArg` | Published when general chart options change (e.g., chart type, model settings). Payload contains the parent view model, the updated chart options model, and chart type. |
**Helper Types**
- `ChartAxisChangedEventArg`
- `ParentVM`: `IBaseViewModel` The view model associated with the chart.
- `Axis`: `string` Identifier for the axis (e.g., `"X"`, `"Y"`, `"Primary"`, `"Secondary"`).
- `MinValue`: `double` New minimum value for the axis.
- `MaxValue`: `double` New maximum value for the axis.
- `ChartOptionsChangedEventArg`
- `ParentVM`: `IBaseViewModel` The view model associated with the chart.
- `Model`: `IChartOptionsModel` The updated chart options model instance.
- `ChartType`: `string` The chart type (e.g., `"Line"`, `"Bar"`, `"Scatter"`).
---
### 3. Invariants
- All events inherit from `Prism.Events.PubSubEvent<T>`, meaning they use Prisms event aggregation pattern for thread-safe, decoupled publish/subscribe communication.
- Boolean events (`ResetZoomChangedEvent`, `CursorShowChangedEvent`, `CursorsClearChangedEvent`, `CursorShowMinMaxChangedEvent`, `CursorsAlailableChangedEvent`) use `bool` payloads to represent *state changes* (e.g., toggled on/off), not necessarily *current values*—subscribers must interpret the payload as the new state.
- `SaveToPDFRequestedEvent`s `string` payload is not validated in this file; its semantics (e.g., path vs. filename) are implementation-dependent.
- `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg` both require a `ParentVM` of type `IBaseViewModel`, implying the event originator must be a view model implementing that interface.
- `ChartOptionsChangedEventArg.Model` must implement `IChartOptionsModel`, but no validation is enforced at the event level.
---
### 4. Dependencies
**Dependencies *of* this module:**
- `Prism.Events` Core dependency for `PubSubEvent<T>`.
- `DTS.Common.Base` Required for `IBaseViewModel` (used in `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg`).
- `DTS.Common.Interface` Required for `IChartOptionsModel` (used in `ChartOptionsChangedEventArg`).
**Dependencies *on* this module:**
- Any component that manages chart UI state (e.g., view models, chart controls) likely subscribes to these events to react to user actions or model changes.
- The `SaveToPDFRequestedEvent` suggests integration with a PDF export service (not visible here).
- The `ChartAxisChangedEvent` and `ChartOptionsChangedEvent` imply coupling with chart rendering logic and data binding systems (e.g., MVVM framework).
---
### 5. Gotchas
- **Misleading XML comments**: All events (except `SaveToPDFRequestedEvent`) have XML comments stating “The Data Folder changed event.” This is clearly incorrect and likely copy-paste error—do not rely on comments for semantics.
- **Typo in class name**: `CursorsAlailableChangedEvent` uses `Alailable` instead of `Available`. This may cause confusion and should be corrected in future refactoring.
- **Ambiguous payload semantics**: Boolean events use `bool` payloads, but it is unclear whether `true` means *enabled*, *visible*, *requested*, or *changed to true*. Subscribers must infer meaning from context or external documentation.
- **No validation on `ChartAxisChangedEventArg`**: No checks ensure `MinValue < MaxValue` or that `Axis` is a recognized identifier. Invalid values may propagate silently.
- **No documentation for `ChartType` values**: The `ChartType` string in `ChartOptionsChangedEventArg` has no documented set of valid values (e.g., `"Line"`, `"Bar"`), risking runtime errors if unexpected values are used.
- **No versioning or deprecation markers**: Events may evolve (e.g., payload changes), but no attributes or comments indicate stability or obsolescence.
*None of the above are explicitly enforced in the source—these are inferred from inconsistencies and omissions.*