Pre loader

How to temporarily pause drawing updates of a realtime data chart?

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
0

I would like a “Pause” button on my chart to temporarily suspend drawing updates, even while realtime data updates are still coming in to the databound DataSeries. Pressing the button again would re-enable drawing updates and show the data lines updated with all the data collected while drawing was previously paused.

Is there anything in the SciChart API to do this easily or would I need to do this manually (possibly by cloning the DataSeries when the chart is paused and databinding to the clones, then restoring the original binding when un-paused)?

Thanks!

  • You must to post comments
0
0

Hi Matthew,

You can suspend all drawing by calling SuspendUpdates:

using(sciChartSurface.SuspendUpdates())
{
     // Do work here, chart is suspended
}
// Chart automatically redraws

OR

IUpdateSuspender s = null;
try
{
    s = sciChartSurface.SuspendUpdates();
    // Do work here, chart is suspended
}
finally
{
   if (s != null)
      s.Dispose();
   // Chart automatically redraws
}

NOTE: This will suspend all drawing, as well as zoom / pan operations, tooltip updates etc… To find out how to use SuspendUpdates in MVVM, click here.

  • Raphael Neumann
    Is there a way in which it is possible to suspend drawing put still be able to zoom/pan the surface?
  • Andrew Burnett-Thompson
    I’m afraid not, panning the surface requires redrawing (otherwise the chart will appear frozen). What are you trying to achieve any why? Perhaps open a new question with your requirement and we may be able to help
  • Embedded Systems
    This solution is not suitable in my case. I don’t want to do any work while the chart is suspended. I just need to pause the chart while clicking the pause button and resume drawing after clicking again. No need to execute any logic while on chart suspended. Is there any way to achieve these in Scichart?
  • Andrew Burnett-Thompson
    H there, the above answer hasn’t changed. SuspendUpdates suspends everything on the chart. If you just want to suspend data updates, we recommend changing the code in your application so you stop sending updates to DataSeries. Many of our examples do this. Search in the examples for ‘Realtime chart examples’ and look at how we’ve implemented start/stop buttons in many of them. Best regards, Andrew
  • Embedded Systems
    Thank you for your reply. Our application also requires strict control on the main thread. Is there a way to specifically suspend and resume the chart drawing only?
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

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

Start TrialCase Studies