highcharts / highcharts-android

Android wrapper for Highcharts usage
Other
126 stars 30 forks source link

Disable series animation #247

Closed haemi closed 6 months ago

haemi commented 1 year ago

I want to disable the initial animation, in the documentation it says I can enable or disable it via setAnimations. But how to disable there? (I also don't understand the default of true as it's an [HIAnimationOptionsObject]).

Setting that parameter to null doesn't help, so how can I disable the animation here?

soommy12 commented 1 year ago

Hi @haemi ! So, that's a tricky question because in Android we cannot set the whole object to false like in the JS library equivalent. But, we can also set the duration of the animation to 0. Unfortunately, this is the only way to achieve your goal. Check the code:

options.setPlotOptions(new HIPlotOptions());
options.getPlotOptions().setSeries(new HISeries());
options.getPlotOptions().getSeries().setAnimation(new HIAnimationOptionsObject());
options.getPlotOptions().getSeries().getAnimation().setDuration(0);
haemi commented 1 year ago

Hi @soommy12 , thanks for your answer! I tried it out, and it also seems faster than before, but it's never 0 - nor 1 or something like that...

May be that the animation can't be disabled completely on Android?

soommy12 commented 1 year ago

I'm really sorry but currently it's the only option that I'm aware of to deal with it.

MikolajMichalczak commented 6 months ago

I can confirm that setting series.animation.duration = 0 works correctly (tested on version 11.4.0).