windowsforms-6890-controls-and-libraries-chart-control-data-representation-empty-points.md
Empty points are points with undefined Values. This document describes how the Chart Control processes empty points.
The Chart displays empty points as breaks in the Line or Area series views, and missing points or bars in other series view types.
The following table contains data for the charts above:
| Date | Politics | Entertainment | Travel |
|---|---|---|---|
| 01-Nov-16 | 65 | 56 | 45 |
| 02-Nov-16 | 78 | 45 | 40 |
| 03-Nov-16 | 95 | 70 | 56 |
| 04-Nov-16 | 110 | 82 | 47 |
| 05-Nov-16 | 108 | 80 | 38 |
| 06-Nov-16 | 52 | 20 | 31 |
| 07-Nov-16 | 46 | 10 | 27 |
| 08-Nov-16 | 70 | 27 | |
| 09-Nov-16 | 86 | 42 | |
| 10-Nov-16 | 92 | 65 | |
| 11-Nov-16 | 108 | 45 | 37 |
| 12-Nov-16 | 115 | 56 | 21 |
| 13-Nov-16 | 75 | 10 | 10 |
| 14-Nov-16 | 65 | 0 | 5 |
To create an empty point, execute one of the following actions:
Leave a point’s value blank if you use the Chart Designer to add points to a series.
Use the SeriesPoint‘s class constructors that take only an argument as a parameter if you add points to a series in code.
Set a data point’s value to Double.NaN in a data source.
You can use the SeriesPoint.IsEmpty property to check whether a point is empty.
Tip
Use a series view’s EmptyPointOptions property to access empty point settings. Specify the EmptyPointOptions.ProcessPoints property to select the manner in which the chart control should handle empty points.
For example, use the following code to display points with predicted values instead of empty points.
using DevExpress.XtraCharts;
public Form1() {
InitializeComponent();
//...
BarSeriesView view = (BarSeriesView)series.View;
EmptyPointOptions emptyPointOptions = view.EmptyPointOptions;
emptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate;
}
Imports DevExpress.XtraCharts
Public Sub New()
InitializeComponent()
'...
Dim view As BarSeriesView = CType(series.View, BarSeriesView)
Dim emptyPointOptions As EmptyPointOptions = view.EmptyPointOptions
emptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate
End Sub
Appearance settings of empty points depends on the series view type. Depending on the view, cast the EmptyPointOptions property value to one of the following classes and configure empty point appearance settings:
The example below configures empty point appearance for line, area, and bar series views. Empty points are painted gray:
LineSeriesView view1 = (LineSeriesView)series1.View;
view1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;
LineEmptyPointOptions lineEmptyPointOptions = view1.EmptyPointOptions;
lineEmptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate;
lineEmptyPointOptions.Color = Color.DarkGray;
lineEmptyPointOptions.LineStyle.DashStyle = DashStyle.Dash;
lineEmptyPointOptions.LineStyle.Thickness = 2;
AreaSeriesView view2 = (AreaSeriesView)series2.View;
AreaEmptyPointOptions areaEmptyPointOptions = view2.EmptyPointOptions;
areaEmptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate;
areaEmptyPointOptions.FillStyle.FillMode = FillMode.Solid;
areaEmptyPointOptions.Color = Color.DarkGray;
areaEmptyPointOptions.Border.Color = Color.Gray;
areaEmptyPointOptions.Border.Thickness = 2;
SideBySideBarSeriesView view3 = (SideBySideBarSeriesView)series3.View;
EmptyPointOptions emptyPointOptions = view3.EmptyPointOptions;
emptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate;
emptyPointOptions.Color = Color.FromArgb(100, Color.DarkGray);
Dim view1 As LineSeriesView = CType(series1.View, LineSeriesView)
view1.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True
Dim lineEmptyPointOptions As LineEmptyPointOptions = view1.EmptyPointOptions
lineEmptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate
lineEmptyPointOptions.Color = Color.DarkGray
lineEmptyPointOptions.LineStyle.DashStyle = DashStyle.Dash
lineEmptyPointOptions.LineStyle.Thickness = 2
Dim view2 As AreaSeriesView = CType(series2.View, AreaSeriesView)
Dim areaEmptyPointOptions As AreaEmptyPointOptions = view2.EmptyPointOptions
areaEmptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate
areaEmptyPointOptions.FillStyle.FillMode = FillMode.Solid
areaEmptyPointOptions.Color = Color.DarkGray
areaEmptyPointOptions.Border.Color = Color.Gray
areaEmptyPointOptions.Border.Thickness = 2
Dim view3 As SideBySideBarSeriesView = CType(series3.View, SideBySideBarSeriesView)
Dim emptyPointOptions As EmptyPointOptions = view3.EmptyPointOptions
emptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate
emptyPointOptions.Color = Color.FromArgb(100, Color.DarkGray)
The Chart does not draw a point between two empty points. To display a point in this case, enable the ShowIsolatedPoints property.
| ShowIsolatedPoints = true | ShowIsolatedPoints = false |
|---|---|
LineSeriesView view = chart.Series[0].View as LineSeriesView;
view.ShowIsolatedPoints = true;
Dim view As LineSeriesView = TryCast(chart.Series(0).View, LineSeriesView)
view.ShowIsolatedPoints = True
InsertEmptyPoints to handle missing points as empty points.