In order to properly handle empty data points, the developer must first determine what strategy to use when handling empty data points at the data analysis level.
Empty Data Point Support in DataSeries Objects
Since null or DBNull.Values are contained in DataSeries objects, each DataSeries object has an attached instance of the EmptyDataPoints class, which is accessible through the EmptyDataPoints property. The most important property of this class is the ValueMode property. It is of type EmptyDataPointsValueMode and accepts the following values (for details, see EmptyDataPointsValueMode Enumeration):
Skip
Average
CustomValue
The following is a description of these modes:
-
Skip: In this mode, empty data points remain unhandled, and the component will not render them.
-
Average: In this mode the component will create an interpolation of the empty data points based on the adjacent existing values. For example if a data series contains the following values:
null, 10, null, null 25, null, 15, null
the result of the interpolation will be:
10, 10, 15, 20, 25, 20, 15, 15
Note that the interpolation will work if there is at least one valid data point. -
CustomValue: In this case the user sets a value that is used as the value for all empty data points (from the CustomValue property). By default it is set to 0. For example, if a data series contains the following values:
null, 10, null, null 25, null, 15, null
the result of the CustomValue mode with CustomValue set to 5 will be:
5, 10, 5, 5, 25, 5, 15, 5Chart with Empty Data Points Skip
(Empty Data Point Not Displayed)Average
(Empty Data Point with Different Appearance)CustomValue
(Empty Data Point Marker at Custom Value 5)
Related Examples
Windows Forms: Series\Data Manipulation\EmptyData Points\EmptyData Points