Back to Devexpress

Empty Points

windowsforms-6890-controls-and-libraries-chart-control-data-representation-empty-points.md

latest10.6 KB
Original Source

Empty Points

  • Jan 22, 2025
  • 10 minutes to read

Empty points are points with undefined Values. This document describes how the Chart Control processes empty points.

Run Demo: 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.

Line View

Spline Area View

Step Line 3D View

Bar View

Point View

The following table contains data for the charts above:

DatePoliticsEntertainmentTravel
01-Nov-16655645
02-Nov-16784540
03-Nov-16957056
04-Nov-161108247
05-Nov-161088038
06-Nov-16522031
07-Nov-16461027
08-Nov-167027
09-Nov-168642
10-Nov-169265
11-Nov-161084537
12-Nov-161155621
13-Nov-16751010
14-Nov-166505

To create an empty point, execute one of the following actions:

You can use the SeriesPoint.IsEmpty property to check whether a point is empty.

Tip

Define How to Handle Empty Points

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.

csharp
using DevExpress.XtraCharts;

    public Form1() {
        InitializeComponent();        
        //...
        BarSeriesView view = (BarSeriesView)series.View;
        EmptyPointOptions emptyPointOptions = view.EmptyPointOptions;
        emptyPointOptions.ProcessPoints = ProcessEmptyPointsMode.Interpolate;
    }
vb
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

Customize Appearance of Empty Points

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:

csharp
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);
vb
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)

Show Isolated Points

The Chart does not draw a point between two empty points. To display a point in this case, enable the ShowIsolatedPoints property.

ShowIsolatedPoints = trueShowIsolatedPoints = false
csharp
LineSeriesView view = chart.Series[0].View as LineSeriesView;
view.ShowIsolatedPoints = true;
vb
Dim view As LineSeriesView = TryCast(chart.Series(0).View, LineSeriesView)
view.ShowIsolatedPoints = True

Empty Points Specifics

  • The Chart Control does not display series labels, tooltips, and the crosshair cursor label for empty points.
  • If a data source contains missing records in arguments, data points are not created. Set the ScaleOptionsBase.ProcessMissingPoints property to InsertEmptyPoints to handle missing points as empty points.
  • Empty points are ignored when you aggregate or resample Chart’s data and the chart contains data next to empty points within the specified interval of the measurement unit.