Pre loader

SCIAnimation completion block

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

1
0

In Scichart 2, we had some code that added some annotations in the SCIAnimation completion block. Here’s a snippet. We need the self.renderAnnotations() to happen AFTER the chart data range is set, because we only draw annotations that will fit within the individual bar stack elements.

        SCIUpdateSuspender.usingWithSuspendable(sciChartSurface) {
            if hasBarData {  
                self.sciChartSurface?.renderableSeries.add(columnCollection)
                let animation = SCIWaveRenderableSeriesAnimation(duration: 1, curveAnimation: .easeOut)
                animation.completionHandler = {
                    self.renderAnnotations()
                    self.configurationButtons?.forEach { $0.isUserInteractionEnabled = true }
                }
                columnCollection.addAnimation(animation)
            }

Here’s the current rewrite to run under Scichart 4. With this code, yAxisLeft.visibleRange has not been updated to the correct data range when renderAnnotations() is called.

Uncommenting the 3 animator-related lines near the bottom doesn’t make a difference, and my listener function is never called.

I’ve also tried wrapping the renderAnnotations() call in a DispatchQueue.main.asyncAfter() call. That sometimes works, and sometimes results in renderAnnotations() not being called at all.

How do I get renderAnnotations() (and the following line looping on configurationButtons) to run, reliably, after the axis range setup is complete?

How do I get my wave animation back?

        SCIUpdateSuspender.usingWith(sciChartSurface) {
            if hasBarData { 
                self.sciChartSurface?.renderableSeries.add(columnCollection)
                    self.renderAnnotations()
                self.configurationButtons?.forEach { $0.isUserInteractionEnabled = true }
//                let animator = SCIAnimations.createWaveAnimator(for: columnCollection)
//                animator.add(self)
//                animator.start()
            }
Version
4.1.1
  • You must to post comments
1
0

Hi, there.

You can do it like this:

1) Create animator:

let animator = SCIAnimations.createWaveAnimator(for: rSeries)

2) Create SeriesAnimatorListener class that conforms to ISCIAnimatorListener protocol:

class SeriesAnimatorListener: NSObject, ISCIAnimatorListener {
    func onAnimationEnd(_ animation: SCIValueAnimator!) {
        print("onAnimationEnd")
    }

    func onAnimationStart(_ animation: SCIValueAnimator!) {
        print("onAnimationStart")
    }

    func onAnimationUpdate(_ animation: SCIValueAnimator!) {
        print("onAnimationUpdate")
    }

    func onAnimationCancel(_ animation: SCIValueAnimator!) {
        print("onAnimationCancel")
    }
}

3) Create an instance of your listener and add it to the animator:

let listener = SeriesAnimatorListener()
animator.add(listener)

4) Run you animation:

animator.cancel()
animator.start(withDuration: 2)

You should have print statements in the console.

let us know if that helped.

Images
  • Hal Mueller
    Thanks. But I am now getting a crash. So I will still call that progress :) When I call `createWaveAnimator(for:columnCollection)`, I see an exception with message “Operation: currentRenderPassData is not avaliable on type: SCIVerticallyStackedColumnsCollection”. I will take that to mean that animations are no longer supported for vertically stacked columns. I can live without the animation, but I do need to have correct data range propagated to the axes before the `renderAnnotations()` call and configurationButtons loop. So I’ll focus there.
  • Andriy P
    Hi, there. Problem is that you can’t animate whole columnCollection. You have animate your renderable series, like this: let rSeries = SCIStackedColumnRenderableSeries() let columnCollection = SCIVerticallyStackedColumnsCollection() columnCollection.add(rSeries) let animator = SCIAnimations.createWaveAnimator(for: rSeries) … Let us know if it works
  • 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