I have a situation in which a reporting service returns generic lists of data as List<Dictionary<string, object>>, where string is the column/data member name I wish to bind to, and object is the value/data point.
Is it possible to bind such a data source to the XamDataChart X and Y Axis definitions?
Here's an example of what the data source would return:
public static List<Dictionary<string, object>> GetDictionarySource()
{
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
var d = new Dictionary<string, object>();
d.Add("Name", "blah");
d.Add("YValue1", 80000);
d.Add("YValue2", 75000);
list.Add(d);
d = new Dictionary<string, object>();
d.Add("Name", "blah1");
d.Add("YValue1", 70000);
d.Add("YValue2", 65399);
return list;
}
Thanks.
I believe you can do something like this is recent versions of the chart
ValueMemberPath="[YValue1]"
etc.
But I don't recall currently which version this functionality was added in. 11.1 possibly, or possibly pending for 11.2. Will have to verify. Give it a try if you are running 11.1
-Graham
Can you confirm whether this feature is in 11.1 or 11.2?
We just tried this in 11.1, but it didn't work. Is there a beta of 11.2 available?
Thanks,
John
Hi,
I asked around and this should work in 11.1, but only if you are running the most recent service release. When I get a moment I will verify this is the case, in the meantime, please make sure you are trying with the most recent service release of 11.1.
Graham,
Thanks for the response. The version that we are running is 11.1.20111.2115.
If this is the latest version, can you please provide an example of how one should bind to the aforementioned List<Dictionary<string,object>> in XAML (e.g., what the X and Y axes bindings look like)? It's possible that we are just doing it incorrectly.
Regards,
Hello John,
I am just checking if you need any further clarifications on the matter.
Petar, for this question it sounds like we will just have to wait until 2011.2. Do you know when this is scheduled for release?
Petar,
Thanks for the follow-up. Since the current release doesn't support binding to a list of dictionaries, we had to come up with an alternative solution that involves converting each dictionary item into a predefined generic class and then binding to a list of these classes.
Hopefully the next release will provision for dictionary binding.
Hi John,
I am just checking if there is anything else can assist you with regarding this matter.
Here is a sneak peek forum post at the 11.2 you can refer to http://blogs.infragistics.com/blogs/jason_beres/archive/2011/09/21/coming-this-fall-a-sneak-peek-at-11-2.aspx .
Please let me know if there is anything else I can do for you regarding this issue.