Hi,
I need to show live (real-time) data on xamdatachart. The problem is, chart should show data only for 30 seconds (configurable) interval. Since my application would be running for hours (may be 6 or more) so I want to know which approach (adjusting WindowRect or Axis Minimum/Maximum value or binding new list of data every second) is the best approach from performance point of view. I will have N number of charts like these, at the least 20).
Any sample to show a working prototype would be a great help.
Thanks,
Rob
Hi Rob,
We have a sample in our WPF Sample Browser that demonstrates real-time data feeds like this. This will be the recommended way for doing this. I believe the sample just sticks with one data source and it constantly adds and removes data points from it. The sample is called Binding Real-Time Data.
I am not able to download it. Please provide the download link.
There's no direct download for that sample. This sample is included in the WPF sample browser which you can install when you install the actual product. There's a download option for it in the platform installer actually. If you go here and click on the Download Free Trial button it will give you the 15.2 platform installer.
I prepared a sample myself. PFA.
In this sample, after 30 seconds, the series doesn't refresh every second but two. Please let me know what's wrong in this.
Regards,
Hey Rob,
I have attached the updated sample. It works fine if I don't comment the line #139 in BindingRealTimeData.xaml.cs.
series.Data.RemoveAt(0);
The line of code deletes the data point past 30 seconds, which I dont want. The chart should be binded to the complete list and the WindowRect should shift to the last 30 seconds.The issue is, if you comment that line and run the app, try adding new series from the buttons on top, it will add the series in code but not on UI.
If you uncomment this line, the app works just fine.
Looking forward to your response.
PS: Don't you have any team to reply in JST zone? I tweeted sometime back and someone from Infragistics responded 'yes', but never got any reply in the same timezone, to resolve issues at the earliest.
The reason leaving that code in works is because both the CategoryDateTimeXAxis and the LineSeries both have 30 points at all times. And when you add in a new series, it initially creates data with 30 points but their values are double.NaN so they don't render on the chart. When you remove that line it no longer works because the CategoryDateTimeXAxis.ItemsSource has a different amount of points in it than the new series does.
In order for a series to render properly when using any of our Category axis types, it's ItemsSource count must match the count inside the Series.ItemsSource. So in your sample, what you can do is add a new CategoryDateTimeXAxis when a new series is added and make sure that the new data is shared between this axis and the new series. You will also have to make sure that you adjust the min+max of the new axis to match the initial CategoryDateTimeXAxis that was created in XAML.
I updated your sample to do this so new series are now rendered properly.
We do have a support team in Japan. However your account is a trial account so our chat system is not available in order to directly speak with them for faster support. For support tickets we guarantee a response within 24 hours of creation. After that, depending on your account support level, we have differing time limits at which we will reply to any ticket updates. Usually we can reply sooner if our case load allows it. You can see more information about our support policies here.