ComponentOne Chart 8.0 for ActiveX
Fast Update Methods

 

Fast Update Methods

Normally, when new data is added to a chart, the entire chart area is repainted. The Fast Update methods provide an alternative and potentially much faster way to add new data to an existing chart if the data falls within the chart's current axes bounds. Only plots, area and polar charts can be fast updated.

The following Fast Update methods are defined by the Chart2DData object:

CheckNewPoints(series, npoints, isxmin, isxmax, isymin, isymax)

Checks whether new data to be added falls within the axes bounds. Series specifies the data series to be added to if the data is in general format; if the data is in array format, all data series are added to. npoints is the number of points to be added; the index of the first point to be added is assumed to be one greater than the value of the LastPoint property. In addition, npoints plus the value of LastPoint must be less than or equal to the value of the NumPoints property. (For example, if LastPoint is 15 and npoints is 3, the indices of the added points are 16, 17 and 18, and NumPoints must be greater than or equal to 18.) isxmin, isxmax, isymin and isymax are return values; the data is inside the current axes bounds only if all four of these values are set to False.

CheckNewPoints returns True if all data is within the axes bounds.

DrawNewPoints(series, npoints)

Draws the new points as quickly as possible. Series specifies the data series to be added to if the data is in general format; if the data is in array format, all data series are added to, and the value of series is ignored. npoints is the number of points to be added; the index of the first point to be added is assumed to be one greater than the value of the LastPoint property.

DrawNewPoints returns True if fast update was possible (if the data falls within existing axes bounds, as verified by CheckNewPoints). When DrawNewPoints returns, the LastPoint property is incremented by npoints.

ShiftPoints(series, npoints, dest, src)

Shifts a block of points in a data series. Series specifies the data series to be shifted. npoints is the number of data points to shift. src is the start index of the data to be shifted, and dest is the destination index. Shifted-out points are set to the value of the HoleValue property.

For example, the following call shifts the three points indexed 7, 8 and 9 to locations 3, 4 and 5 respectively:

Chart2D1.ChartGroups(1).Data.ShiftPoints 1, 3, 3, 7

This method is used in charts that plot a continuous stream of real-time data. The stripper demo, included with ComponentOne Chart, is an example of a chart that uses this method.

Examples

Here is a simple example of code that uses the Fast Update methods:

With Chart2D1.ChartGroups(1).Data

       ' .LastPoint is assumed to have the value 9

       .x(1, 10) = 15.4
       .y(1, 10) = 23.1
       .x(1, 11) = 7.2
       .y(1, 11) = 20.8
       .DrawNewPoints 1, 2

End With

For a more practical example of code that uses the Fast Update methods, refer to the Timer1 procedure defined in the stripper demo program.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback