7.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:57:20.201859+00:00 | zai-org/GLM-5-FP8 | 1 | a2e58408ee52b3f9 |
Documentation: ChartOptionsModel.cs
1. Purpose
ChartOptionsModel is a state management class for chart configuration options within the DTS Viewer application. It serves as the data model backing chart visualization controls, managing unit types (EU, mV, V, PSD, FFT), time units, axis scaling modes, filter selections, cursor behavior, and zoom/pan state. The class implements INotifyPropertyChanged via BasePropertyChanged to support MVVM data binding and coordinates with a parent IChartOptionsViewModel to publish configuration changes.
2. Public Interface
Properties
| Property | Type | Access | Description |
|---|---|---|---|
DisplayingVolts |
bool |
get/set | Controls whether voltage displays as "V" (true) or "mV" (false). Raises OnPropertyChanged for "MVOrV" and "UnitTypeDescription" when changed. |
MVOrV |
string |
get | Returns "V" if DisplayingVolts is true, otherwise "mV". |
IsDigitalChannel |
bool |
get/set | Indicates whether the current channel is digital. |
SupportsADC |
bool |
get/set | Indicates ADC support for the current context. |
SupportsMV |
bool |
get/set | Indicates mV unit support. |
UnitType |
ChartUnitTypeEnum |
get/set | The current unit type (EU, mV, PSD, FFT, etc.). Changing this sets ReadData = true and auto-adjusts Filter. |
UnitTypeDescription |
string |
get | Returns the display string for UnitType. Returns "V" or "mV" when UnitType == ChartUnitTypeEnum.mV. |
TimeUnitType |
TimeUnitTypeEnum |
get/set | Time axis unit. Defaults to TimeUnitTypeEnum.MS. Changing sets ReadData = true. |
TimeUnitTypeDescription |
string |
get/set | String representation of TimeUnitType. |
SelectedFilter |
IFilterClass |
get/set | Currently selected filter class. Changing sets ReadData = true. |
MinFixedY |
double |
get/set | Minimum Y-axis value for fixed scaling. |
MaxFixedY |
double |
get/set | Maximum Y-axis value for fixed scaling. |
MinFixedT |
double |
get/set | Minimum T (time) axis value for fixed scaling. |
MaxFixedT |
double |
get/set | Maximum T (time) axis value for fixed scaling. |
FullScaleValues |
List<double> |
get/set | Returns _euValues if UnitType is EU or PSD, otherwise _fullScaleValues. |
SelectedFullScaleValue |
double |
get/set | Currently selected full-scale value. Defaults to 100. |
LockedT |
bool |
get/set | Whether the time axis is locked. |
LockedY |
bool |
get/set | Whether the Y-axis is locked. |
ShowCursor |
bool |
get/set | Cursor visibility. Setter calls Parent?.ShowCusor(value). |
CurrentCursorValues |
string |
get/set | Current cursor values display string. |
YRange |
YRangeScaleEnum |
get/set | Y-axis range mode. Setting to Fixed automatically sets LockedY = true. |
Filter |
FilterOptionEnum |
get/set | Filter option enum. Changing sets ReadData = true. |
Parent |
IChartOptionsViewModel |
get/set | Parent view model reference. |
CanPublishChanges |
bool |
get/set | Controls whether property changes trigger Parent.PublishChanges(). Defaults to true. |
IsCursorsAvailable |
bool |
get/set | Whether cursors are available for the current context. |
T0Cursor |
bool |
get/set | T0 cursor flag. |
MinMaxCursors |
bool |
get/set | Min/Max cursors flag. |
ReadData |
bool |
get/set | Flag indicating data should be re-read. |
IsSaved |
bool |
get | Saved status (setter not visible in source). |
DecimateData |
bool |
get/set | Getter returns false if UnitType is PSD or FFT, otherwise returns backing field value. |
WidthPoints |
long |
get/set | Width points for decimation. |
Commands
| Command | Type | Description |
|---|---|---|
ResetZoomCommand |
DelegateCommand |
Executes ResetZoomMethod(), which delegates to Parent.ResetZoomMethod(). |
ResetTCommand |
DelegateCommand |
Executes ResetTMethod(), which delegates to Parent.ResetTMethod(). |
SaveToPDFCommand |
DelegateCommand |
Executes SaveToPDFMethod(), which delegates to Parent.SaveToPDFMethod(). |
Methods
| Method | Signature | Description |
|---|---|---|
ChartOptionsModel |
public ChartOptionsModel() |
Empty constructor. |
SetSelectedFilterToUnfilteredNoRead |
public void SetSelectedFilterToUnfilteredNoRead() |
Sets SelectedFilter to unfiltered without setting ReadData = true. |
OnPropertyChanged |
public void OnPropertyChanged(string propertyName) |
Raises PropertyChanged event and conditionally calls Parent?.PublishChanges(). |
Events
| Event | Type | Description |
|---|---|---|
PropertyChanged |
PropertyChangedEventHandler |
Standard INotifyPropertyChanged event. |
3. Invariants
-
UnitType → Filter coupling: When
UnitTypeis set to anything other thanEUorPSD,Filteris automatically set toFilterOptionEnum.Unfiltered. When set toEUorPSD,Filteris set toFilterOptionEnum.TestSetupDefault. -
YRange → LockedY coupling: Setting
YRangetoYRangeScaleEnum.Fixedautomatically setsLockedY = true. -
DecimateData PSD/FFT exclusion:
DecimateDatagetter always returnsfalsewhenUnitTypeisChartUnitTypeEnum.PSDorChartUnitTypeEnum.FFT, regardless of the backing field value. -
FullScaleValues selection: The property returns
_euValues(5000, 2500, 1000, 500, 100, 50, 10, 5) forEUorPSDunit types, and_fullScaleValues(200, 100, 50, 20, 10, 5, 1, 0.1) otherwise. -
ReadData side effects: Setting
UnitType,TimeUnitType,SelectedFilter, orFilterautomatically setsReadData = true.
4. Dependencies
This module depends on:
DTS.Common— Common utilitiesDTS.Common.Classes.Sensors—FilterClassimplementationDTS.Common.Enums.Viewer—ChartUnitTypeEnum,TimeUnitTypeEnum,FilterOptionEnum,YRangeScaleEnumDTS.Common.Interface—IChartOptionsModelinterfaceDTS.Common.Interface.Sensors.SoftwareFilters—IFilterClassinterfacePrism.Commands—DelegateCommandfor MVVM commandsCommon.Base.BasePropertyChanged— Base class providingSetPropertymethod for INotifyPropertyChanged implementation
What depends on this module:
IChartOptionsViewModelimplementations (referenced asParentproperty)
5. Gotchas
-
Typo in method call: In
ShowCursorsetter, the code callsParent?.ShowCusor(_showCursor)— note the misspelling "Cusor" instead of "Cursor". This may cause confusion when searching for the method definition. -
Conditional PublishChanges suppression: The
OnPropertyChangedmethod explicitly skips callingParent?.PublishChanges()for specific property names:"CanPublishChanges","Parent","ReadData","UnitTypeDescription","ShowCursor","LockedT","LockedY","MVOrV","DisplayingVolts","DecimateData","WidthPoints". This is not documented elsewhere and could lead to unexpected behavior. -
IsSaved property has no visible implementation: The property has only a getter with no backing field or setter visible in the source. Its behavior is unclear from this file alone.
-
SetSelectedFilterToUnfilteredNoRead bypasses normal flow: This method directly sets the backing field
_selectedFilterand setsReadData = false, bypassing the normal property setter which would setReadData = true. -
Inconsistent property change patterns: Some properties use
SetProperty(ref _field, value, "PropertyName")while others manually check equality and callOnPropertyChanged. This inconsistency may indicate incremental development over time.