7.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T03:02:47.862961+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 9ab60417b631bbdf |
Graphs
Documentation: IGraph Interface
1. Purpose
The IGraph interface defines the contract for a graph entity that aggregates and manages a collection of IGroupChannel instances for visualization purposes. It extends IGraphRecord, which provides database-backed metadata (e.g., name, axis limits, thresholds), while adding runtime behavior for channel management and XML serialization/deserialization. This interface serves as the core abstraction for graph configuration in the system—enabling persistence, dynamic channel composition, and axis/threshold configuration—without dictating implementation details (e.g., UI rendering or data acquisition logic).
2. Public Interface
IGraph Interface
(Extends IGraphRecord)
-
void AddChannel(IGroupChannel groupChannel)
Adds a newIGroupChannelto the graph’s internal channel collection. Must be called before serialization or rendering to include the channel. -
void RemoveChannel(IGroupChannel groupChannel)
Removes an existingIGroupChannelfrom the graph’s internal channel collection. After removal, the channel is no longer part of the graph’s state. -
void ReadXML(System.Xml.XmlElement root, IReadOnlyDictionary<long, IGroupChannel> channelLookup)
Deserializes graph configuration from an XML element (root). UseschannelLookupto resolve channel references (by ID) intoIGroupChannelinstances. Populates the graph’sGroupChannels(inferred fromChannelsString) and other properties (e.g., axis limits, thresholds) from XML data. -
void WriteXML(ref System.Xml.XmlWriter writer)
Serializes the graph’s current state (including channels, thresholds, and axis limits) to XML using the providedXmlWriter. The format is expected to be compatible withReadXML. -
void UpdateChannelAndThresholdStrings()
Synchronizes theChannelsStringandThresholdsStringproperties with the current in-memoryGroupChannelsandThresholdscollections. This must be called before persistence or serialization to ensure data consistency.
IGraphRecord Interface
(Base interface—no methods, only properties)
-
int GraphId { get; set; }
Primary key in the database for this graph record. -
int TestSetupId { get; set; }
Foreign key referencing the associated test setup. -
string GraphName { get; set; }
Human-readable name (max 50 characters). -
string GraphDescription { get; set; }
Description of the graph’s purpose (max 50 characters). -
string ChannelsString { get; set; }
Serialized representation of channel IDs or configurations (max 2048 characters). Must be kept in sync with the in-memory channel collection viaUpdateChannelAndThresholdStrings(). -
bool UseDomainMin { get; set; }
Flag indicating whether to constrain the domain (X) axis minimum. -
double DomainMin { get; set; }
Minimum value for the domain axis (only meaningful ifUseDomainMinistrue). -
bool UseDomainMax { get; set; }
Flag indicating whether to constrain the domain (X) axis maximum. -
double DomainMax { get; set; }
Maximum value for the domain axis (only meaningful ifUseDomainMaxistrue). -
bool UseRangeMin { get; set; }
Flag indicating whether to constrain the range (Y) axis minimum. -
double RangeMin { get; set; }
Minimum value for the range axis (only meaningful ifUseRangeMinistrue). -
bool UseRangeMax { get; set; }
Flag indicating whether to constrain the range (Y) axis maximum. -
double RangeMax { get; set; }
Maximum value for the range axis (only meaningful ifUseRangeMaxistrue). -
string ThresholdsString { get; set; }
Serialized representation of threshold definitions (max 2048 characters). Must be kept in sync with the in-memory thresholds viaUpdateChannelAndThresholdStrings(). -
bool LocalOnly { get; set; }
[Deprecated] Flag indicating whether the graph should be local-only (not synchronized with a central database). Do not rely on this property.
3. Invariants
ChannelsStringandThresholdsStringmust accurately reflect the contents of the in-memory channel and threshold collections after any modification to those collections.
→ Enforced by callingUpdateChannelAndThresholdStrings()explicitly.GraphNameandGraphDescriptionare constrained to ≤50 characters (via[MaxLength]attribute).ChannelsStringandThresholdsStringare constrained to ≤2048 characters (via[MaxLength]attribute).DomainMin/DomainMax,RangeMin/RangeMaxvalues are only semantically valid when their respectiveUse*flags aretrue.LocalOnlyis deprecated and its value is ignored; it should not be used for any logic.
4. Dependencies
-
Depends on:
DTS.Common.Interface.Channels.IGroupChannel(for channel management).System.Collections.Generic.IReadOnlyDictionary<long, IGroupChannel>(used inReadXMLto resolve channel IDs).System.Xml(for XML serialization/deserialization).System.ComponentModel.DataAnnotations(for validation attributes onIGraphRecordproperties).
-
Depended on by:
- Likely concrete implementations (e.g.,
Graph,TestGraph) in other modules (not visible here). - Persistence layers (e.g., database accessors) that serialize/deserialize graphs via
ReadXML/WriteXML. - UI components that consume
IGraphto render charts with axis limits and thresholds.
- Likely concrete implementations (e.g.,
5. Gotchas
-
ChannelsString/ThresholdsStringare not auto-updated.
Modifications to the in-memory channel/threshold collections (e.g., viaAddChannel/RemoveChannel) will not automatically updateChannelsString/ThresholdsString. CallingUpdateChannelAndThresholdStrings()is mandatory before persistence or serialization—failure to do so will result in stale or incorrect data being saved. -
ReadXMLrelies on an externalchannelLookupdictionary.
The method does not construct channels itself; it assumeschannelLookupcontains all referenced channels by their IDs. If a channel ID in the XML is missing fromchannelLookup, behavior is undefined (likely a runtime error or skipped channel). -
LocalOnlyis deprecated and ignored.
Do not use this property for any logic (e.g., sync decisions). Its presence suggests legacy behavior that may be removed in future versions. -
No explicit
GroupChannelsorThresholdsproperties are declared inIGraphorIGraphRecord.
These are inferred from the summary comment onUpdateChannelAndThresholdStrings()and likely implemented as read-only properties (e.g.,IReadOnlyList<IGroupChannel> GroupChannels { get; }). Their exact signatures are not visible in the provided source. -
No validation on axis limits (e.g.,
DomainMin < DomainMax) is enforced in the interface.
Implementation-specific validation (if any) is not visible here.