Object tree - sharing LightningChart objects

Known limitations / issues in LightningChart

Moderator: Queue Moderators

User avatar
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Object tree - sharing LightningChart objects

Post by ArctionPasi » Mon Sep 19, 2016 12:54 pm

LightningChart object model is tree-based. Every class has it's parent object, and list of child objects. With aid of this tree, child object notifies parent of its changes, so that parent can respond to it respectively, and parent notifies its parent chain until reaching the root node, LightningChartUltimate itself, so it knows how to refresh accordingly.

Objects also have reference to their unmanaged counterparts, like GPU resources. Disposing of shared objects explicitly by user code, or internally by LightningChart, will very likely lead into crashing, black screen, or flickering problems.

Therefore: Sharing objects between other objects is forbidden.

Example 1 of wrong usage:

Code: Select all

AnnotationXY annotation1 = new Annotation(); 

AnnotationXY annotation2 = new Annotation(); 
annotation2.Fill = annotation1.Fill; 
WRONG. Same Fill object can't be shared between multiple objects.
Correct way: Only copy properties if they are of ValueType (e.g. Integer, Double, Color)

Example 2 of wrong usage:

Code: Select all

SeriesEventMarker marker = new SeriesEventMarker(); 

WRONG. Same object shouldn't be added to collection of multiple collections.
Correct way: Create own marker for both series.
LightningChart Support Team, PT