I am trying to use Data Sampling with a DateTime-based data series. In my main project, I want to dynamically adjust the sampling unit and interval based on the user's zoom level (e.g.turn off sampling when zoomed in to 1 minute, set sampling to 15 minutes when zoomed out to 1 day).
Explicitly setting my SamplingUnit and SamplingUnitInterval works for any value other than NONE. My data is at 1-second intervals, so Second and NONE should be identical. However, SamplingUnit of NONE samples my data at 4-second intervals.
I have a sample project to demonstrate this, but I don't see how to attach the zip file (I can only attach image files).
Thanks,
Brandon
6 Answers, 1 is accepted
I see my problem now. This post (https://www.telerik.com/forums/bind-samplingthreshold) clued me in.
The default SamplingThreshold is 1000. So when I set my SamplingUnit to NONE, it doesn't actually disable sampling, it just reverts to using the threshold value. If I want to effectively have no sampling and see every data point, I need to set my SamplingThreshold to a value greater than the number of points in my data set.
Hello Brandon,
Thank you for the detailed description of your scenario.
Indeed, such an optimization sounds logical and I will forward it to our development team. I will update you with their statement once we have a definitive answer.
To answer your question, I do not see a way to achieve this at the moment with the current API, but we will now consider treating this as a feature request and implementing it in our source code.
Regards,
Dilyan Traykov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hello Brandon,
After discussing this with our development team, we have the following proposition for your particular scenario:
As data sampling would not make sense when each point is its own group, you can change the ItemsSource of your series to the actual collection instead of using the ChartDataSource when the zoom level is big enough to see the individual data points. This will also avoid the other overhead required for constructing the data source, apart from the aggregations.
Please let us know if such an approach would work for you.
Regards,
Dilyan Traykov
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Thank you for the response. I'm not quire sure how I would switch between the actual collection and the ChartDataSource when my zoom level changes. I can see how I would do this when I zoom in enough that I want to use the actual collection, but how do I change the ItemsSource back to the ChartDataSource when I zoom back out a level that I want to use data sampling again?
Regards,
Brandon
Hello Brandon,
I've prepared a small sample project where I've demonstrated how you can switch back and forth to the ChartDataSource depending on the zoom level which is applied.
Can you please have a look and let me know if a similar approach would work in your original application? I will be awaiting your reply.
Regards,
Dilyan Traykov
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.