I have a collection of objects that contain everything that I need to create a series and I want to use a DataTemplate to create series for however many objects are in the collection. Unfortunately, it seems that there are no DataTemplate examples in any of your explanations and I don't know if this is even possible.
Is it possible to create a number of series at runtime using DataTempates?
Hello Ed,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
After reviewing the multiple series examples, I was forced to change from a MVVM ViewModel which contained the data, to the less desirable data code behind. I am almost finished with the changeover, but I feel this is far from ideal.
I was also hoping I could place all of my Series into the SeriesCollection and have them automatically displayed, but I don't see how to bind the SeriesCollection with the XamDataSource or ItemsSource.
Additionally, the documentation link for SeriesCollection is broken, so I can't review any code samples about this.
Is there a way to bind a Series of the XamDataChart to a Column in a DataTable like you did in this how to article ? This would work well for my needs, but it seems like you have used a different kind of chart for this example.
The link you provided is a step by step guidance for WindowsForms UltraChart. I have used a similar approach with DataTabel bound to WPF’s XamDataChart to create a sample project for you with the same functionality.
Hope this helps you.
Thank you for the sample code, it was very helpful. I am having a problem with additions to the DataTable not showing up in the XamDataChart. Is there another step that needs to occur in order for live DataTables to display series in the XamDataChart?
Thanks,
Ed
I am not aware of a specific step that needs to be done in order to achive the functionality you want. Basically it doesn't matter how your DataTable is filled, static or dynamic, if you follow the approach I gave yo uin my previos post, everything should works correctly.
That's the problem, I updated your example to add rows to your DataTable on a DispatchTimer expecting to see them represented in the xamDataChart and there were no updates. I attached the modified project for your viewing here.
Hi Team,
Can we display dynamic multiple series in bar chart type.Do you have any sample to do that.
Regards,
Sridhar
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thanks Stefan, I will use this information moving forward!
Our developers said that this behavior is expected since the DataTable doesn't implement INotifyPropertyChanged interface and the XamDataChart cannot be notified when the DT changes, so I can suggest you use reset the DataContext like this in the timer_Tick event handler:
private void timer_Tick(object sender, EventArgs e) { int x, y; x = rand.Next(3, 23); y = rand.Next(3, 26); table.Rows.Add(new object[] { "Point", x, y }); this.DataContext = null; this.DataContext = table.DefaultView; }
Hope this heslp you.
Thank you much for your help Stefan!