I bind the SeriesSource property of the ChartSurface to an ObservableCollection in my ViewModel, the chart is updated whenever the collection is updated. This has been working OK.
The feature I want to implement is to ZoomExtent the chart surface whenever the SeriesSource is updated. Since the length of my series are different, when I switch from one series to another, the chart only displays a part of the new series if the new series is longer than the old one.
My initial attempt was creating an Eventhandler in Viewmodel and register it to the CollectionChanged event of the ObservableCollection. Then I got stuck there.
How do I trigger the ZoomExtent function in the eventhandler?
Or I am on the wrong track completely? Thank you for you help.
Thanks for the inquiry! SciChart provides several ways of achieving this, and most of them are convenient for your particular case. Here they are:
So I would suggest you calling IDataSeries.InvalidateParentSurface(RangeMode.ZoomToFit) in the handler, because you can easily access DataSeries inside the VM. Alternatively, you can add magic Two-way binding on SciChart’s ZoomExtentsCommand or ViewportManager to corresponding properties in the VM and use them instead.
Please, feel free to ask if you need more assistance with this.
Please login first to submit.