Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
UIStackView animation on chart (re)load
posted

We are generating a big array of IGDataPoint's on a background thread. When finished, we call to the main thread and "refresh" the chart by removing/adding the series. This is the most effective way we've found to re-render the chart. (Is there another way?) As you may know, UIStackView uses the "hidden" property to allow easy animations. Unfortunately, the hidden property seems incompatible with the IGChartView. If chart is hidden in viewDidLoad it doesn't seem to render when not hidden. Thoughts? I'd love to be able to animate the chart.

  • 26458
    Offline posted

    The only way to animate the chart series is to use its transitionDuration property. It should animate every time you re-add the series, as long as you have set the animation parameters.

    For example, 

    series.isTransitionInEnabled = YES;
    series.transitionDuration = 3;
    series.transitionInMode = IGCategoryTransitionInModeSweepFromLeft;

    I'm attaching a small test project. You can tap the label to refresh the series. 

    LineSeriesAnimation.zip