7.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:55:59.501828+00:00 | zai-org/GLM-5-FP8 | 1 | 7f2f2e90f6f17587 |
Documentation: ChartOptionsViewModel
1. Purpose
ChartOptionsViewModel is a Prism-based ViewModel that manages chart configuration options for the DTS Viewer application. It serves as an intermediary between chart views and the event system, handling axis range settings, unit type selection (EU, mV, ADC), cursor visibility controls, and publishing chart option changes to other application components. The module supports multiple parent contexts including IViewerMainViewModel and IPSDReportMainViewModel, with different initialization behaviors for each.
2. Public Interface
Constructor
public ChartOptionsViewModel(
IChartOptionsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
Initializes the ViewModel, sets up interaction requests, and subscribes to ChartAxisChangedEvent.
Properties
| Property | Type | Description |
|---|---|---|
Parent |
IBaseViewModel |
Reference to the parent ViewModel. |
NotificationRequest |
InteractionRequest<Notification> |
Prism interaction request for notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Prism interaction request for confirmations. |
View |
IBaseView |
Associated view instance. |
Model |
IChartOptionsModel |
The chart options model; setter triggers OnPropertyChanged("Model"). |
ContextSearchRegion |
object |
Region context for search functionality. |
IsMenuIncluded |
bool |
Hides base member; menu inclusion flag. |
IsNavigationIncluded |
bool |
Hides base member; navigation inclusion flag. |
IsBusy |
bool |
Hides base member; busy state indicator. |
IsDirty |
bool |
Hides base member; dirty state (get-only). |
ChartOptionsVisability |
bool |
Controls visibility of chart options UI; defaults to false. |
ClearMarkersCommand |
DelegateCommand |
Command that invokes ClearMarkersMethod(). |
Methods
| Method | Signature | Description |
|---|---|---|
Initialize |
override void Initialize() |
Empty override; no implementation. |
Initialize |
override void Initialize(object parameter) |
Main initialization accepting IViewerMainViewModel or Tuple<IBaseViewModel, string> containing IPSDReportMainViewModel. Sets up model, subscriptions, and configures based on parameter type. |
ShowMinMaxCursor |
void ShowMinMaxCursor(bool value) |
Publishes CursorShowMinMaxChangedEvent with the boolean value. |
ResetZoomMethod |
void ResetZoomMethod() |
Sets Model.YRange to AutoRange and publishes ResetZoomChangedEvent(true). |
ResetTMethod |
void ResetTMethod() |
Publishes ResetZoomChangedEvent(false). |
SaveToPDFMethod |
void SaveToPDFMethod() |
Publishes SaveToPDFRequestedEvent with the Directory path. |
PublishChanges |
void PublishChanges() |
Publishes ChartOptionsChangedEvent with ChartOptionsChangedEventArg containing ParentVM, Model, and ChartType. |
ShowCusor |
void ShowCusor(bool value) |
Publishes CursorShowChangedEvent with the boolean value. |
OnPropertyChanged |
new void OnPropertyChanged(string propertyName) |
Raises PropertyChanged event. |
3. Invariants
-
Model Resolution:
Modelmust be resolved via_unityContainer.Resolve<IChartOptionsModel>()before use; it is not resolved in the constructor but inInitialize(object parameter). -
Parent Matching for Events: Event handlers (
OnChartAxisChangedEvent,OnGraphSelectedChannelsChanged) checkargs?.ParentVM != Parentand return early if the event is not intended for this instance. -
Publish Control:
Model.CanPublishChangesmust betruefor changes to propagate viaPublishChanges(). It is set tofalseduring batch configuration updates. -
Unit Type Fallback: If channels do not support ADC or mV (determined by
AllChannelsSupportADC/AllChannelsSupportmV), theUnitTypefalls back toChartUnitTypeEnum.EU. -
ADC/mV Support Detection: Both
AllChannelsSupportADCandAllChannelsSupportmVreturnfalseif any channel's parent module has a TSR AIR serial number (checked viaHardwareConstants.IsTSRAIRSerialNumber). -
Graph Chart Type Constraints: When
chartType == "Graph", the model is configured with:UnitType = ChartUnitTypeEnum.PSDYRange = YRangeScaleEnum.FixedMaxFixedY = 1MinFixedY = 1e-12(non-zero for log scale)DecimateData = false
4. Dependencies
This Module Depends On:
DTS.Common.Base-BaseViewModel<IChartOptionsViewModel>DTS.Common.Enums.Viewer-ChartUnitTypeEnum,YRangeScaleEnum,FilterOptionEnumDTS.Common.Events-ChartAxisChangedEvent,CursorsAlailableChangedEvent,GraphSelectedChannelsNotification,CursorShowMinMaxChangedEvent,ResetZoomChangedEvent,SaveToPDFRequestedEvent,ChartOptionsChangedEvent,CursorShowChangedEvent,CursorsClearChangedEventDTS.Common.Interface-IChartOptionsViewModel,IChartOptionsModel,IChartOptionsView,IBaseViewModel,IBaseView,IViewerMainViewModel,IPSDReportMainViewModel,ITestChannelDTS.Common.Interactivity- Interaction requestsDTS.Common.Enums.Hardware-HardwareConstants.IsTSRAIRSerialNumber()Prism.Events-IEventAggregatorPrism.Regions-IRegionManagerPrism.Commands-DelegateCommandUnity-IUnityContainer
What Depends On This Module:
- Not explicitly shown in source; inferred consumers include:
IChartOptionsViewimplementationsIViewerMainViewModelimplementationsIPSDReportMainViewModelimplementations
5. Gotchas
-
Misleading XML Documentation: The constructor's XML comment references
TestSummaryViewModelinstead ofChartOptionsViewModel— appears to be copy-paste tech debt. -
newKeyword Hiding: Multiple members (IsMenuIncluded,IsNavigationIncluded,IsBusy,IsDirty,ConfirmationRequest,Model,PropertyChanged,OnPropertyChanged) use thenewkeyword to hide base class members. This can cause unexpected behavior when casting to base types. -
Typo in Property Name:
ChartOptionsVisabilityshould beChartOptionsVisibility. -
Typo in Method Name:
ShowCusorshould beShowCursor. -
Typo in Event Handler:
OnCursorsAlailableChangedandCursorsAlailableChangedEventmisspell "Available" as "Alailable". -
Identical ADC/mV Logic:
AllChannelsSupportADCandAllChannelsSupportmVhave identical implementations. The comment inAllChannelsSupportADCsuggests this may be placeholder logic based on serial numbers, with future sophistication planned. -
Unused/Private Fields: Several ReSharper suppressions (
UnassignedGetOnlyAutoProperty,NotAccessedField.Local,UnusedAutoPropertyAccessor.Local) suggest dead code or incomplete implementations. -
Commented-Out Constructor Code: Lines resolving and assigning
Modelin the constructor are commented out, suggesting initialization was moved toInitialize(object parameter). -
Directory Property Purpose Unclear: The
Directoryproperty is set from the first selected channel'sBinaryFilePathand used only inSaveToPDFMethod(). The relationship between chart options and this directory is not documented.