How can I bind the XamWebChart to a SeriesCollection. I'm getting data from a service, in Xml format, containing the values and styles for few series' with several datapoints.
I created SeriesCollection in my ViewModel. Now how should I bind my view to make it use the SeriesCollection to draw graphs.
You will want to check this post to get you started:
https://ko.infragistics.com/community/forums/f/ultimate-ui-for-wpf/38169/series-binding-in-xaml-custom-attached-property
Unfortunately there seems to be a problem with the forums this morning, so this post isn't currently accessible.
-Graham
Its back up. So you can check that out if you want. But the exampl linked is really more for if you want to create the series based on a template in Xaml. If you are already creating the series collection in your View Model have you tried just binding it to the chart?
I.E if the property holding the SeriesCollection on your DataContext is called Series. Have you tried
<XamWebChart Series="{Binding Series} ...
Hi Graham,
Your reply helped. But when I try to update the datacontext of the control later sometime, its not getting updated. Its always showing the initial data.
I have all the property change notifications in place.
In the code, when I get new data I updated the data context as,
ChartControl.DataContext = newVM;
Help me.
Are you sure you are changing the data context at the right level? In the example I posted, if I change the chart's DataContext the series are updated. Are you changing the data context above the element which you originally set it on? Do you have a sample you can provide that exhibits the behavior you are seeing?
The bug is in review, you can check its status at any point by contacting Developer Support and providing them the bug number 30475.
Does this problem exists in both DataVisualization and Silverlight XamWebCharts?
Your problem is that when you are setting the actual DataContext programmatically you are setting it at a higher level than you are setting it inside the user control. The DataContext set on the chart will take precedence over the UserControl's DataContext. You have to replace the DataContext at the same level or lower than it was originally set.
One way to resolve your problem would be to give the chart in your user control a name
e.g. x:Name="theChart"
and then instead of this line:
ucChart.DataContext = vmChart;
write
(ucChart.FindName("theChart") as FrameworkElement).DataContext = vmChart;
let me know how it goes.
Thank you very much Graham. That works like a charm. If possible, please keep me posted about the bug status.
Thank you.
Please help me with rendering part.
I have used the code as is, it's not rendering anything on the screen.
I am referring to the post made by:
[Infragistics] Graham Murray on 07-26-2010 5:31 PM
Is there a slightly easier way to achieve databinding rather than use what Graham has suggested?
Hello,
Thank you for your post. I have been looking into it, but since in the thread there are a coouple of samples and links to other threads with samples, could pelase send me the one that you have issues with.
Looking forward for your reply.
Hello Graham,
I have been trying to use your example with the latest version of Infragistics Wpf release. However in the function GetAxes, you have code such as this:
xAxis = (series as AnchoredCategorySeries).XAxis;But there is no property called XAxis defined anymore. It seems that they have removed this property. How do I modify the code to get this example to work with the new version of infragistics 2012 version.
Hi,
Where are you running into the overhead? Do you have a profile? You may be able to tweak that method a bit to avoid the issue. There should be a bit of overhead when the custom type is generated, but as long as most of the dynamic types look the same it should be hitting the dictionary for each subsequent type that needs to be created.
Also, xamGrid probably supports binding against dictionaries, I would assume, is there a reason you aren't using that approach?
I'm not too familar with the xamGrid's backlog. I'd recommend makign a feature request, or possibly emailing productmanager@infragistics.com to inquire further.