8.1 KiB
8.1 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:09:08.434841+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9646cefae729c3f3 |
ChartOptions
Documentation Page: Chart Options Module
1. Purpose
This module defines the core interfaces for the Chart Options view layer in the DTS Viewer subsystem. It establishes the contract between the UI (IChartOptionsView), its data-binding context (IChartOptionsViewModel), and the underlying state and business logic (IChartOptionsModel). The module enables user interaction with chart configuration options—such as scaling, units, timebase, filtering, cursor visibility, and export functionality—while enforcing separation of concerns via the MVVM pattern. It exists to decouple chart presentation logic from data acquisition and rendering, allowing flexible configuration of chart behavior without tight coupling to specific chart implementations.
2. Public Interface
IChartOptionsView
- Inherits:
IBaseView - Description: Marker interface for the view (e.g., XAML UserControl) responsible for rendering the chart options UI. No additional members beyond base view contract.
IChartOptionsViewModel
- Inherits:
IBaseViewModel - Properties:
IBaseView View { get; set; }– Binds to the associated view instance.IBaseViewModel Parent { get; set; }– Reference to the parent view model (e.g., main chart view model).IChartOptionsModel Model { get; set; }– Reference to the model containing chart configuration state.object ContextSearchRegion { get; set; }– Holds context for a search region (type not specified; likely used for region selection or filtering).
- Methods:
void PublishChanges()– Commits pending configuration changes (e.g., to chart rendering or data processing).void ResetZoomMethod()– Resets Y-axis zoom to default (likely auto-scale).void ResetTMethod()– Resets T-axis (timebase) zoom to default.void SaveToPDFMethod()– Triggers export of the current chart view to PDF.void ShowCusor(bool value)– Controls visibility of the primary cursor (note: typo in method name—Cusorvs.Cursor).void ShowMinMaxCursor(bool value)– Controls visibility of min/max cursor indicators.
IChartOptionsModel
- Inherits:
IBaseModel - Properties:
bool SupportsADC { get; set; }– True if all channels support analog-to-digital conversion.bool SupportsMV { get; set; }– True if all channels support millivolt measurement.bool DisplayingVolts { get; set; }– True if units are displayed in Volts; false implies millivolts.string MVOrV { get; }– Returns"mV"or"V"based onDisplayingVolts.List<double> FullScaleValues { get; set; }– List of available full-scale range values (e.g., [1.0, 2.0, 5.0]).double SelectedFullScaleValue { get; set; }– Currently selected full-scale value.double MinFixedY { get; set; }/MaxFixedY { get; set; }– Fixed Y-axis range limits (used whenYRangeisFixed).double MinFixedT { get; set; }/MaxFixedT { get; set; }– Fixed T-axis (time) range limits.bool LockedT { get; set; }– True if T-axis range is locked (prevents auto-adjustment).bool LockedY { get; set; }– True if Y-axis range is locked.bool ShowCursor { get; set; }– Controls primary cursor visibility.string CurrentCursorValues { get; set; }– String representation of cursor positions (e.g.,"t=1.23s, y=45.6mV").YRangeScaleEnum YRange { get; set; }– Scaling mode for Y-axis (e.g., Auto, Fixed, FullScale).ChartUnitTypeEnum UnitType { get; set; }– Unit type for Y-axis (e.g., Voltage, Pressure).TimeUnitTypeEnum TimeUnitType { get; set; }– Unit type for T-axis (e.g., Seconds, Minutes).string UnitTypeDescription { get; }– Human-readable description ofUnitType(e.g.,"Voltage (mV)").FilterOptionEnum Filter { get; set; }– Selected filter type (e.g., None, LowPass, HighPass).IFilterClass SelectedFilter { get; set; }– Instance of the selected filter implementation (e.g.,ButterworthFilter).bool IsCursorsAvailable { get; set; }– True if cursor functionality is enabled for the current chart.bool CanPublishChanges { get; set; }– Indicates whetherPublishChanges()should be allowed (e.g., after validation).bool ReadData { get; set; }– Controls whether new data should be read/refreshed after changes.bool IsDigitalChannel { get; set; }– True if the chart is displaying digital (logic) channel data.bool DecimateData { get; set; }– True if data decimation is applied for performance.long WidthPoints { get; set; }– Number of data points horizontally displayed (e.g., 1000 points).
- Commands:
DelegateCommand ResetZoomCommand { get; }– Binds toResetZoomMethod().DelegateCommand ResetTCommand { get; }– Binds toResetTMethod().DelegateCommand SaveToPDFCommand { get; }– Binds toSaveToPDFMethod().
- Methods:
void SetSelectedFilterToUnfilteredNoRead()– Resets the filter to "unfiltered" state without triggering data reload.
3. Invariants
IChartOptionsModel.Modelmust be non-null and assigned beforeIChartOptionsViewModeloperations (e.g.,PublishChanges()) are invoked.DisplayingVoltsandMVOrVmust be consistent:MVOrVreturns"V"iffDisplayingVoltsistrue.YRange,MinFixedY,MaxFixedY,MinFixedT,MaxFixedT, andLockedT/LockedYmust be coherently interpreted by consumers (e.g., ifLockedYistrue,MinFixedY/MaxFixedYare fixed and unchanging).IsCursorsAvailablemust betruefor cursor-related methods (ShowCusor,ShowMinMaxCursor) to have effect.SelectedFiltermust be a validIFilterClassinstance whenFilteris notFilterOptionEnum.None.CanPublishChangesmust betruebefore callingPublishChanges()to avoid invalid state transitions.
4. Dependencies
- Depends on:
DTS.Common.Base(forIBaseView,IBaseViewModel,IBaseModel).DTS.Common.Enums.Viewer(forYRangeScaleEnum,ChartUnitTypeEnum,TimeUnitTypeEnum).DTS.Common.Interface.Sensors.SoftwareFilters(forIFilterClass).Prism.Commands(forDelegateCommand).
- Used by:
- Likely consumed by chart rendering/view components (e.g.,
IChartView/IChartViewModel) to configure display parameters. - View models for chart pages or dialogs that expose chart options.
- Likely consumed by chart rendering/view components (e.g.,
- Implied consumers: Any class implementing
IChartOptionsView(e.g., WPFUserControl) andIChartOptionsViewModel(e.g.,ChartOptionsViewModel).
5. Gotchas
- Typo in method name:
ShowCusor(bool value)usesCusorinstead ofCursor. This may cause confusion or mismatches in binding if not consistently handled. - Ambiguous
ContextSearchRegion: Type isobjectwith no documentation on expected structure or usage. Its purpose (e.g., region coordinates, search term) is unclear from this interface alone. SetSelectedFilterToUnfilteredNoRead()semantics: TheNoReadsuffix implies it avoids reloading data, but no documentation clarifies whether this affectsReadDataor other state.SupportsADC/SupportsMVare "all channels" checks: These are global flags (not per-channel), meaning partial channel support may not be reflected.MVOrVis read-only: Its value is derived fromDisplayingVolts; direct mutation is impossible, so consumers must updateDisplayingVoltsinstead.- No validation rules exposed: While
CanPublishChangesexists, there is no documented criteria for when it becomestrue(e.g., required fields, range checks).
None identified beyond the above.