Pre loader

Tag: Events

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
7k views

Hello,
I would like to ZoomOut immedeatly after new data is rendered.
I would like to have flexibility in Zooming Out, therefore I cannot use AutoRange.Always.
I have implemented ZoomOut in SciChartSurface.Rendered, but that seems to be too early, as it doesnt react on the new data, instead zooms out based on the old data.
I have to wait 100 ms, then it works and it zooms out based on the new data.
Is there an event even after SciChartSurface.Rendered that is better suited to call the ZoomOut function?

I have used the technique described in the answer below. However, I am awaiting the dataChange and then call ZoomOut. It still doesnt work.

In my Code behind:

            await viewModel.DisplayData();
            viewModel.ZoomOut();

DisplayData adds LineRenderableSeriesViewModel with DataSeries to the RenderableSeries Observable Collection.

And in my ViewModel:

    internal void ZoomOut()
    {
        if (RenderableSeries.Count() > 0)
        {
            var parentSurface = ((LineRenderableSeriesViewModel)RenderableSeries.ElementAt(0)).DataSeries.ParentSurface;
            var viewportManager = parentSurface.ViewportManager;
            viewportManager.BeginInvoke(() =>
                {
                    viewportManager.AnimateZoomExtents(TimeSpan.FromMilliseconds(250));
                });

        }
    }

This way it works:

            await viewModel.DisplayData();
            await Task.Run(()=>System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(500)));
            viewModel.ZoomOut();

But that can’t be the solution – I need an event that fires when all the data is known to sciChartSurface.

Thanks,
Holger

Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies