This is a migrated thread and some comments may be shown as answers.

DataBind and Empty Values

3 Answers 108 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 07 Apr 2008, 01:32 PM
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?

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 08 Apr 2008, 11:45 AM
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
0
Patrick
Top achievements
Rank 1
answered on 08 Apr 2008, 12:57 PM
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
0
Giuseppe
Telerik team
answered on 09 Apr 2008, 02:25 PM
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
Tags
Chart (Obsolete)
Asked by
Patrick
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Patrick
Top achievements
Rank 1
Share this question
or