PhoenixFly PhoenixFly - 5 months ago 33
Vb.net Question

RadHtmlChart not skipping NULL values

I have a RadHtmlChart that includes NULL values and instead of skipping or interpolating the values, they are counted as zero.

Here is my chart:

<Telerik:RadHtmlChart ID="rhc" runat="server">
<PlotArea>
<Series>
<Telerik:ScatterLineSeries Name="Intl" DataFieldX="a1" DataFieldY="a2" MissingValues="Interpolate">
<TooltipsAppearance DataFormatString="{1:N}% on {0:MM/dd}" />
<MarkersAppearance Visible="true" />
</Telerik:ScatterLineSeries>
<< - I have 7 more entries following - >>
</Series>
<XAxis BaseUnit="Weeks" Step="1">
<LabelsAppearance DataFormatString="{0:MM/dd}" />
</XAxis>
<YAxis MaxValue="102" MinValue="0" Step="5">
<TitleAppearance Text="Percentage" />
</YAxis>
</PlotArea>
<Legend>
<Appearance Position="Bottom" />
</Legend>
</Telerik:RadHtmlChart>


I am setting the data source for the chart in the code behind. Here is a small sample:

a1 a2 b1 b2 c1 c2 d1 d2
5/02/2016 100 5/02/2016 96 5/02/2016 100 5/02/2016 (NULL)
5/09/2016 100 5/09/2016 100 5/09/2016 100 5/09/2016 (NULL)
5/16/2016 66 5/16/2016 100 5/16/2016 100 5/16/2016 100
5/23/2016 88 5/23/2016 80 5/23/2016 100 5/23/2016 100
5/30/2016 100 5/30/2016 100 5/30/2016 100 5/30/2016 (NULL)

e1 e2 f1 f2 g1 g2 h1 h2
5/02/2016 100 5/02/2016 100 5/02/2016 100 5/02/2016 98
5/09/2016 100 5/09/2016 5 5/09/2016 100 5/09/2016 83
5/16/2016 100 5/16/2016 (NULL) 5/16/2016 (NULL) 5/16/2016 80
5/23/2016 20 5/23/2016 66 5/23/2016 (NULL) 5/23/2016 63
5/30/2016 100 5/30/2016 100 5/30/2016 (NULL) 5/30/2016 100


A1 through H2 is all 1 record for each date. I have checked that I am setting the "MissingValues" argument on every line series. I followed my data source in debug mode and made sure that no values were being set to zero before assigning it to the chart, yet it still displays zeros.

Answer

It's unclear what the expected behavior is. Do you want the days with a null number value not to show at all? You'd be better off removing them from the data before binding if this is the case.

Sorry, my VB is too rusty, so here's some C#;

List<Day> dataSource = getData();

foreach(Day d in dataSource)
    if (d.Number == null)
        dataSource.Remove(d);