DataBind and Empty Values

Thread is closed for posting
4 posts, 0 answers
  1. Patrick
    Patrick avatar
    2 posts
    Member since:
    Apr 2008

    Posted 07 Apr 2008 Link to this post

    I want to bind a list of value pairs (A/B) to a RadChart, whereas both values of a pair are of type double and the value of B can be double.NaN in some pairs. But if there is a pair which contains a double.NaN, the system throws an exception.
    My DataSource is a list of custom objects and the Chart contains two series.

    Is there a possibility to define which bound value has to be interpreted as Empty?
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 08 Apr 2008 Link to this post

    Hello Patrick,

    You cannot customize the interpretation of the EmptyValue for RadChart. We are not sure how are you binding the control to a list of pairs, however, Double.NaN is recognized and treated as an empty value out-of-the-box when the control is bound to a simple list:

    ASPX
    <telerik:RadChart ID="RadChart1" runat="server"
    </telerik:RadChart> 

    Code-behind:
    List<double> list = new List<double>(); 
     
    list.Add(.2); 
    list.Add(Double.NaN); 
    list.Add(.8); 
     
    RadChart1.DataSource = list
    RadChart1.DataBind(); 



    Sincerely yours,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Patrick
    Patrick avatar
    2 posts
    Member since:
    Apr 2008

    Posted 08 Apr 2008 Link to this post

    Hello Manuel,

    thank's for your quick reply.
    As I wrote, I use a list of custom objects. The pair A/B is built by two properties of the object, wheras one series of the chart contains the values of A, another series contains the values of B. The label is filled from a third property.
    But there is no problem with that construction so far. The problem occurs, when one value is double.NaN.

    Even your example with the simple List which contains a double.NaN does not work for me. Like before I the system throws the Exception:

        Die Eingabezeichenfolge hat das falsche Format.   bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)    bei System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) 
    ...

    The problem seems, that I am using a german locale, so that the result of double.NaN.ToString() is "n. def.". The internal parsing methods of the databind seem to not interprete that correctly.

    Sincerely yours,
        Patrick
  4. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 09 Apr 2008 Link to this post

    Hi Patrick,

    Indeed you are right -- we were able to reproduce the problem when we switched to German culture. We have updated your Telerik points for the report and have forwarded this issue to our developers. We believe the fix will be part of the official Q1 2008 release that is scheduled for next week.

    Sorry for the temporary inconvenience.


    Greetings,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top