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

85 lines
6.5 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ResetZoomChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorShowChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorsClearChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorShowMinMaxChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/CursorsAlailableChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/SaveToPDFRequestedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ChartAxisChangedEvent.cs
- Common/DTS.CommonCore/Events/DTS.Viewer/ViewerChartOptions/ChartOptionsChangedEvent.cs
generated_at: "2026-04-16T02:50:11.916711+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "16f84af1488883a8"
---
# ViewerChartOptions
## Documentation: Viewer Chart Options Events Module
### 1. Purpose
This module defines a set of Prism-based pub/sub events used to communicate state changes and user requests related to chart viewer options in the DTS system. These events enable decoupled communication between chart UI components (e.g., view models, views, controllers) and backend logic—specifically for toggling cursor/zoom behavior, axis adjustments, chart configuration changes, and export actions. The events are part of the `DTS.Common.Events` namespace and rely on the `CompositePresentationEvent<T>` base class from Prism for cross-thread subscription and publication.
---
### 2. Public Interface
All event classes are *payload-only*—they carry no methods or properties beyond their inherited event infrastructure. Each inherits from `CompositePresentationEvent<TPayload>` and defines a strongly-typed payload.
| Event Class | Payload Type | Description |
|-------------|--------------|-------------|
| `ResetZoomChangedEvent` | `bool` | Indicates that the reset-zoom state has changed (e.g., whether reset-zoom is enabled or active). |
| `CursorShowChangedEvent` | `bool` | Indicates that the visibility state of the primary cursor has changed. |
| `CursorsClearChangedEvent` | `bool` | Indicates that the state of the “clear cursors” action has changed (e.g., whether clearing is allowed or requested). |
| `CursorShowMinMaxChangedEvent` | `bool` | Indicates that the state of displaying min/max values alongside cursors has changed. |
| `CursorsAlailableChangedEvent` | `bool` | *Note: Typo in class name—intended `CursorsAvailableChangedEvent`.* Indicates that the availability state of cursors has changed (e.g., whether cursors are enabled for interaction). |
| `SaveToPDFRequestedEvent` | `string` | Signals a request to save the current chart to PDF. The payload is a string—likely a suggested filename or export path. |
| `ChartAxisChangedEvent` | `ChartAxisChangedEventArg` | Signals that one chart axis (X or Y) has been adjusted. Payload contains updated axis bounds and the parent view model. |
| `ChartOptionsChangedEvent` | `ChartOptionsChangedEventArg` | Signals that high-level chart options (e.g., type, model settings) have changed. Payload includes the updated model, chart type, and parent view model. |
#### Payload Types
| Type | Fields | Description |
|------|--------|-------------|
| `ChartAxisChangedEventArg` | `IBaseViewModel ParentVM`, `string Axis`, `double MinValue`, `double MaxValue` | Encapsulates axis change details. `Axis` is likely `"X"` or `"Y"`. |
| `ChartOptionsChangedEventArg` | `IBaseViewModel ParentVM`, `IChartOptionsModel Model`, `string ChartType` | Encapsulates chart configuration change. `Model` holds serializable chart settings; `ChartType` identifies the visualization mode (e.g., `"Line"`, `"Bar"`). |
---
### 3. Invariants
- **Event naming convention**: All event classes end with `ChangedEvent` (for state changes) or `RequestedEvent` (for user-initiated actions).
- **Payload semantics**:
- Boolean events (`ResetZoomChangedEvent`, `CursorShowChangedEvent`, etc.) use `true`/`false` to represent *on/off* or *enabled/disabled* states—**not** toggling actions.
- `SaveToPDFRequestedEvent` payload is a `string`—interpreted as a *request* (not a confirmation), so the payload likely represents a *target* (e.g., filename or path), not a result.
- **ParentVM usage**: In `ChartAxisChangedEventArg` and `ChartOptionsChangedEventArg`, `ParentVM` is non-null and identifies the originating view model—enabling subscribers to scope responses to specific chart instances.
- **No validation in event classes**: Payload objects contain no validation logic; subscribers must enforce constraints (e.g., `MinValue ≤ MaxValue`).
---
### 4. Dependencies
#### Dependencies *of* this module:
- `Microsoft.Practices.Prism.Events` → Provides `CompositePresentationEvent<T>`.
- `DTS.Common.Base` → Provides `IBaseViewModel` interface.
- `DTS.Common.Interface` → Provides `IChartOptionsModel` interface.
#### Dependencies *on* this module:
- Any module/view model/view that needs to react to chart viewer option changes (e.g., chart rendering logic, cursor management, export handlers).
- Specifically:
- Subscribers to `ChartAxisChangedEvent` likely update axis scales in chart controls.
- Subscribers to `SaveToPDFRequestedEvent` likely trigger PDF export workflows.
- UI components (e.g., toolbar buttons) may publish `ResetZoomChangedEvent`/`CursorShowChangedEvent` to reflect toggle states.
---
### 5. Gotchas
- **Typo in class name**: `CursorsAlailableChangedEvent` is misspelled (`Alailable` instead of `Available`). This is preserved in the source and must be respected in code.
- **Misleading XML comments**: All events (except `SaveToPDFRequestedEvent`) have a comment `/// <summary>The Data Folder changed event.</summary>`, which is incorrect and likely copy-paste error. This does not affect runtime behavior but may confuse developers.
- **Ambiguous boolean semantics**: The meaning of `true`/`false` in boolean events is not standardized in the source. For example, `CursorShowChangedEvent` with `true` could mean *“show cursors”* or *“cursor visibility changed to visible”*—subscribers must infer intent from context or external documentation.
- **No event grouping**: Related events (e.g., cursor toggles) are defined separately, requiring subscribers to subscribe to each individually. No composite event or enum-based alternative is provided.
- **No deprecation markers**: Despite the typo, no `[Obsolete]` attribute or migration path is indicated.
None identified beyond the above.