SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

1
0

i want to insert 500 data on the left of chart.
then, it freezes slightly.
so, i want to present indicator.
how can i listen to start and end of drawing?

Version
2.2.1.2265
• You must to post comments
2
0

Hello mssup,

Before you try present busy indicator, please see our performance tips and tricks article, it might help you to omit such issues in the first place.

First of all, I would suggest you to append data in batches and inside SCIUpdateSuspender block, like below:

[SCIUpdateSuspender usingWithSuspendable:surface withBlock:^{
}];


which should improve performance, also, the SciChart renderer will start rendering right after step out of the block, so you can consider end of the block as start rendering, and can show your busy indicator.

To listen to end of drawing rendererCallback property on renderSurface, please see the code below:

self.surface.renderSurface.renderedCallback = ^(int _) {
<#code#>
};


in which you can stop showing your indicator.

Hope that helps, if you still face some issues, feel free to prepare sample project and send us for investigation.

UPDATE for SciChart.iOS v3.x

renderedCallback is removed in v3.x and now it’s replaced by the SCIChartSurfaceRenderedListener block. Please see the code below:

    self.surface.setRenderedListener { (surface, renderedMessage) in
print("SurfaceRendered")
<#code#>
}


Best regards,
Nazar R.

• Hi Brad, there is a sciChartSurface.onSciChartRendered event instead. Check the members of ISCIChartSurface protocol here: https://www.scichart.com/documentation/ios/current/Protocols/ISCIChartSurface.html#/c:objc(pl)ISCIChartSurface(im)onSciChartRendered. Does this help?
• Andrew in working through this I don’t have it quite right. I am trying to call sciChartSurface.setRenderedListener(myViewController) so that my view controller’s implementation of onSciChartRendered will be called, however that doesn’t work. I am more accustomed to working with delegates, so if you can provide an example of how to properly listen for this event that would be great. Thanks!
• hello Brad. Since it’s a block, you can’t implement it in your viewController, you must do that via closure\lambda or store that as a property\variable. I’ve updated the answer, so you might want to try it out. Best Regards, Nazar.
• Thank you Nazar that was very helpful – I have my code all straightened out now. However I have a new crash earlier on in SciRenderSurfaceDrawable2D before I even get to my render callback. The last output in the console is: 2020-04-26 13:34:42.041085-0400 IT[41040:8653335] Series name: Low Alarm 2020-04-26 13:34:42.041486-0400 IT[41040:8653335] Series name: High Alarm 2020-04-26 13:34:42.041663-0400 IT[41040:8653335] Series name: Ambient °F Then I hit an EXC_BAD_ACCESS with the following stack trace: Thread 1 Queue : com.apple.main-thread (serial) #0 0x00000001047c59a0 in SCRT2DRenderingPipeline::Begin() () #1 0x00000001045ea0bc in -[SCIRenderSurfaceDrawable2D drawFrameIn:withDrawableSize:] () #2 0x00000001046ef3d0 in -[SCITwisterRendererBase drawFrameIn:withDrawableSize:] () #3 0x00000001046083c4 in -[SCIMetalRenderer drawFrameIn:withDrawableSize:] () #4 0x0000000104644e78 in -[SCIMetalRenderSurfaceBase draw] () #5 0x00000001a3457250 in -[CALayer display] () #6 0x00000001a34666e4 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) () #7 0x00000001a33ab170 in CA::Context::commit_transaction(CA::Transaction*, double) () #8 0x00000001a33d5f7c in CA::Transaction::commit() () #9 0x00000001a09cbb2c in _afterCACommitHandler () #10 0x000000019c836668 in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ () #11 0x000000019c831308 in __CFRunLoopDoObservers () #12 0x000000019c8318b8 in __CFRunLoopRun () #13 0x000000019c831084 in CFRunLoopRunSpecific () #14 0x00000001a6a7f534 in GSEventRunModal () #15 0x00000001a09a1670 in UIApplicationMain () Are you familiar with what may cause this crash? Thank you again for any suggestions on why this may be happening.
• The above crash looks to be resolved in the 3.1 release. I was seeing it in 3.0, but no longer see it in 3.1.
Showing 1 result