Handling empty data points at presentation level
In This Topic
The empty data points can be displayed in a variety of ways. The appearance of the empty data points is controlled by a NEmptyDataPointsAppearance object attached to each NSeries object. An instance of this class can be obtained through the EmptyDataPointsAppearance property.
C# |
Copy Code
|
NEmptyDataPointsAppearance edpAppearance = series.EmptyDataPointsAppearance;
|
Visual Basic |
Copy Code
|
Dim edpAppearance As NEmptyDataPointsAppearance = series.EmptyDataPointsAppearance
|
Appearance
The way in which empty data points are visualized is controlled by the AppearanceMode property, which accepts the values of the EmptyDataPointsAppearanceMode enumeration. Following is a description of the possible modes:
-
Normal - in this mode the empty data points are displayed as if they are normal data points. The series is responsible for assigning fill styles and stroke styles.
-
Special - in this mode the empty data points are displayed with user defined fill style and border style. This is very useful if you want to distinguish between empty and normal data points. The shape of the data item is determined by the series - only the appearance is different. You can control the applied fill style trough the FillStyle property of the NEmptyDataPointsAppearance object. The border style is controlled through the BorderStyle property.
-
None - in this mode Empty Data Points filling and borders are not displayed.
The following code will apply red filling and yellow border for the empty data points:
C# |
Copy Code
|
edpAppearance.AppearanceMode = EmptyDataPointsAppearanceMode.Special;
edpAppearance.FillStyle = new NColorFillStyle(Color.Red);
edpAppearance.BorderStyle = new NStrokeStyle(Color.Yellow);
|
Visual Basic |
Copy Code
|
edpAppearance.AppearanceMode = EmptyDataPointsAppearanceMode.Special
edpAppearance.FillStyle = New NColorFillStyle(Color.Red)
edpAppearance.BorderStyle = New NStrokeStyle(Color.Yellow)
|
Markers
The appearance of empty data point markers is controlled by the MarkerMode property which is of type EmptyDataPointsMarkerMode. There are two possible modes:
-
Normal - marker styles for empty data points are assigned the same way as for normal data points.
-
Special -empty data points are displayed with a special marker style, defined by the MarkerStyle property.
The following example applies a special marker style for the empty data points:
C# |
Copy Code
|
edpAppearance.MarkerMode = EmptyDataPointsMarkerMode.Special;
edpAppearance.MarkerStyle.PointShape = PointShape.Sphere;
edpAppearance.MarkerStyle.FillStyle = new NColorFillStyle(Color.Red);
|
Visual Basic |
Copy Code
|
edpAppearance.MarkerMode = EmptyDataPointsMarkerMode.Special
edpAppearance.MarkerStyle.PointShape = PointShape.Sphere
edpAppearance.MarkerStyle.FillStyle = New NColorFillStyle(Color.Red)
|
Data Labels
The appearance of empty data point labels is controlled by the DataLabelMode property which is of type EmptyDataPointsLabelMode. There are two possible modes:
- Normal - data label styles for empty data points are assigned the same way as for normal data points.
- Special - empty data points are displayed with a special data label style, defined by the DataLabelStyle property.
The following example applies a special data label style for the empty data points of some series:
C# |
Copy Code
|
series.EmptyDataPointsAppearance.DataLabelMode = EmptyDataPointsLabelMode.Special;
series.EmptyDataPointsAppearance.DataLabelStyle.Visible = true;
series.EmptyDataPointsAppearance.DataLabelStyle.Format = "EDP: <value>";
series.EmptyDataPointsAppearance.DataLabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.Red);
|
Visual Basic |
Copy Code
|
series.EmptyDataPointsAppearance.DataLabelMode = EmptyDataPointsLabelMode.Special
series.EmptyDataPointsAppearance.DataLabelStyle.Visible = True
series.EmptyDataPointsAppearance.DataLabelStyle.Format = "EDP: <value>"
series.EmptyDataPointsAppearance.DataLabelStyle.TextStyle.FillStyle = New NColorFillStyle(Color.Red)
|
Related Examples
Windows forms: All Examples\Data Manipulation\EmptyData Points\General Example
See Also