Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Nulls in xamDataChart result in empty chart


I'm plotting a lot of time data that may have gaps in. Previously, these gaps would have been connected together to form a continuous line. Our customer desires these to be actual gaps where the data is missing. The graphed data is averaged over minutes so I've merged the data with a list of nulled values, so that where there's a gap it appears as a double? null. (Previously tried double.NAN)

When I perform the merging function using 0 instead of null I get the graph I'm expecting, with it dropping down to zero where there isn't data.

However, when I try to get gaps by using null values the graph is just blank.

Here's the data object I'm graphing:

public class SensorValue
public DateTime MeasureTime { get; set; }
public double? Value { get; set; }


and I've configured it like this:

//Set Data
series.DataContext = sensor;
series.ValueMemberPath = "Value";
var itemSorceBinding = new Binding("Data.SensorValues");
series.SetBinding(Infragistics.Controls.Charts.Series.ItemsSourceProperty, itemSorceBinding);

Any idea why the graph is just showing no data?

No Data
  • 250
    Verified Answer

    I used double.NaN and get exactly what I want. The reason this wasn't working when I originally tried it (before using null) was because I was using a Spline Series I believe. I changed it to line. LineSeries doesn't seem to like null values but works fine with NaN.

No Data