Charts > Using the Charts Library > Data Handling > Sharing Data Among Charts
 
Sharing Data Among Charts
With the Charts Library, data can be shared among different charts. The same data set can be set for several chart data objects and the same chart data object can be set on several chart objects. Figure 6.1 illustrates these basic rules.
Figure 6.1    Sharing Data
In this figure, Data set 2 is used by both the Chart data 0 and the Chart data 1 chart data objects. The chart data object Chart data 1 is set on both the Chart 1 and the Chart 2 chart objects to manage the data sets they display. This means that Chart 1 and Chart 2 will display the same data.
Data sharing is possible due to a lock/unlock system that has been implemented for data sets and for chart data objects. Each time you add a data set to a chart data object, the data set will be automatically locked by a call to the IlvChartDataSet::lock method. In the same way, each time you set a chart data object on a chart object, the chart data object will be automatically locked by a call to the lock method.
Similarly, each time you remove a data set from a chart data object, the data set will be automatically unlocked by a call to the IlvChartDataSet::unLock method. Each time you remove a chart data object from a chart object, the chart data object will be automatically unlocked by a call to the unLock method.
(See the lock and unLock methods of the IlvChartDataSet and IlvAbstractChartData class in the reference manual for more information.)

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.