Telerik blogs

The Q1 2011 version of the Chart control will include code to support empty/null values. There are many scenarios, in which the property of an object, or a collection of objects, to which the Chart is data bound, is null. The following code example demonstrates one such case:

clip_image002

The null values above are hard-coded, however they convey the general idea of null values being returned by the data layer, to which the Chart is data bound.

Internally, there are three ways in which these null values can be handled. This is specified by a property in the control, for the series definition, named EmptyPointBehavior. This is a dependency property, which is defined per Series Definition. It has three options:
1. Zero.This property is the default property of each series. When this option is used, each null value is replaced with a zero. The data entry is not removed from the data collection. Only its original null/empty value is replaced with zero. This behavior is demonstrated in the screenshot below, where the data points at positions 3 and 4 had originally been empty(null), and internally replaced by 0 :
clip_image004

2. Gap. This option visually removes the regions for each set of empty(null) points. The data entry is not removed from the data collection. Essentially, it connects the points neighboring the null point (or the collection of empty values). Again, assuming that the data points at positions 3 and 4 have null values, the rendered chart will look like this:

clip_image006

3. Drop - this option clips, or visually removes each section/segment, corresponding to a set of empty points/values. A Chart rendered using this option would look like this:

clip_image008

We will be happy to know what you think about it!


Vesselin Georgiev
About the Author

Vesselin Georgiev

Vesselin Georgiev is a principal software developer at Progress on the Telerik Xamarin & UWP Team. He started here back in 2006 as a support officer on the ASP.NET team. Later, he moved to Silverlight, WPF, UWP, and Xamarin development but kept his passion for customer satisfaction. He also loves traveling, hiking and good food.

Comments

Comments are disabled in preview mode.