Chart for .NET / User's Guide / Data Manipulation / Empty Data Points / Empty Data Points Overview

Empty Data Points Overview
 What are empty data points

A data point is considered "empty" if one or more of its mandatory values are set to DBNull.Value. The following example creates a line series and adds three values:

C#
Copy Code
NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.Values.Add(10);
line.Values.Add(DBNull.Value);
line.Values.Add(20);
Visual Basic
Copy Code
Dim line As NLineSeries = chart.Series.Add(SeriesType.Line)
line.Values.Add(10)
line.Values.Add(DBNull.Value)
line.Values.Add(20)

The second data point of the line will be considered empty since the Y value of the line series is required, but is set to DBNull.Value.

In the following example the second data point is not considered empty even though the X value of the data point is set to DBNull.Value. This is because the line series is not switched in XY scatter mode and the X values are not mandatory.

C#
Copy Code
NLineSeries line2 = (NLineSeries)chart.Series.Add(SeriesType.Line);
line2.Values.Add(10);
line2.Values.Add(15);
line2.Values.Add(20);

line2.XValues.Add(10);
line2.XValues.Add(DBNull.Value);
line2.XValues.Add(20);
Visual Basic
Copy Code
Dim line2 As NLineSeries = chart.Series.Add(SeriesType.Line)
line2.Values.Add(10)
line2.Values.Add(15)
line2.Values.Add(20)

line2.XValues.Add(10)
line2.XValues.Add(DBNull.Value)
line2.XValues.Add(20)

If later in your code you set the UseXValues property of the line2 series to true, the second data point will become an empty data point, because the X value will become mandatory.

C#
Copy Code
line2.UseXValues = true;
Visual Basic
Copy Code
line2.UseXValues = True
 Empty Data Points Processing

Empty data points are processed at two stages:

  • analysis at data level

  • analysis at presentation level

The analysis at data level determines what strategy the component uses to assign values to empty data points (so that they can be rendered). For more information please refer to the Empty Data Points at Data Analysis Level topic.

The analysis at presentation level defines the way in which empty data points are visualized. For more information please refer to the Empty Data Points at Presentation Level topic.

 Related Examples
Windows forms: Chart Gallery\Data Manipulation\Empty Data Points\General Example
Windows forms: Chart Gallery\Data Manipulation\Empty Data Points\Float Bar, High Low
Windows forms: Chart Gallery\Data Manipulation\Empty Data Points\Bubble
See Also