Chart for .NET / User's Guide / Data Manipulation / Empty Data Points / Handling empty data points at data analysis level

In This Topic
    Handling empty data points at data analysis level
    In This Topic

    In order to properly handle empty data points the developer must first determine what strategy to use to handle empty data points at data analysis level.

     Empty data point support in NDataSeries

    Empty data points are represented in data series with the DBNull.Value. Each NDataSeries object has an attached instance of the NEmptyDataPoints 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:

    Skip
    Average
    CustomValue

    Following is a description of these modes:

    • Skip - in this mode the empty data point remains unhandled and the component will not render it.

    • 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 all empty data points are replaced by a custom value (defined through 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, 5

    Chart with empty data points
    Skip (Empty Data Points are not displayed)
    Average (Empty Data Points are displayed with grey color)
    CustomValue (Empty Data Point markers at custom value 5)
     Related Examples
    Windows forms: Chart Gallery\Data Manipulation\EmptyData Points\EmptyData Points
    See Also