SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
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.