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!
- Matthew Becker asked 7 years ago
- You must login to post comments
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.
- Andrew Burnett-Thompson answered 7 years ago
- Is there a way in which it is possible to suspend drawing put still be able to zoom/pan the surface?
- 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
- 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?
- 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
- 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 login to post comments
Please login first to submit.