I am using the 2016.1 XamDataChart with the ImmediateLineSeries configuration (this uses the writable bitmap to speed up redraws for complex data).
I am adding points to the plot data collection in real time, and wish to make this act like a stripchart that displays the last 200 points - but also allow stopping and zooming to look at any of the data that has been collected sofar.
I found that as points are added to the collection and the ActualMaximumValue is hit, the collection is resized and the display rescales to show the new data + some extra space. The amount of the resize depends on the existing size of the collection, and appears to be about a 10% increase each time.
Rather than a percentage increment, what I would like is to use a fixed (say 200 points) increment on each resize (which makes the stripchart work great), but I cannot find any way to get access to do this. Any suggestions on how to proceed here?
Thanks,
Gary
Hello Gary,
Unfortunately, there currently does not exist a way to access the way that the "auto-interval" of the XamDataChart is calculated. It is, however, possible to set your own interval on the axes of the XamDataChart.
Since you are using the custom ImmediateLineSeries solution, this means you are essentially utilizing a ScatterLineSeries with a custom renderer, meaning both axes will be numeric. Each numeric axis has a MinimumValue and MaximumValue property, as well as an Interval property for determining the first, last, and how frequent the labels are drawn. Perhaps you could keep an eye on your bound collection to your underlying ImmediateLineSeries.ItemsSource and increment the MinimumValue, MaximumValue, and Interval properties as it changes? Perhaps, if your underlying collection implements the INotifyCollectionChanged interface, you could do this in the CollectionChanged event of that collection.
I'd like to know your thoughts on this, as I'm not entirely sure whether or not this approach would truly work for your scenario. Please let me know if I may be of further assistance on this matter.
Sincerely,AndrewAssociate Developer
Thanks for the suggestions! I have a semi-workable solution which uses the commonXAxis.RangeChanged event to set the WindowScaleHorizontal to the desired stripchart size.
For this to work, I need to anticipate when the axis is about to rescale and append the bound collection with NaN (placeholder non-displaying) data points which are updated with real data as it arrives. The NaN points force a minimum range increment which deals with the too-small increment when the collection is still small.
Still working out the best way to do this - maybe just have a single larger (5K points) NaN data set which prevents "small" (<200 points) autoresize events, as the resize amount appears to be a 10% increase each time. Also having some issues with performance when the dataset gets upto 100K points or so which I need to understand.
I will make a suggestion that the chart have a mode added that sets the autoresize amount.