PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.55k stars 9.01k forks source link

Easing animation for highlighting in Pie Chart #3482

Open azri92 opened 6 years ago

azri92 commented 6 years ago

Currently, the default highlighting pops in and out without any easing - making it look jumpy. Is there a way to add some easing to the highlight?

mpardieck commented 3 years ago

You can achieve this effect by animating the PieDataSet selectionShift property itself. Run this in the onValueSelected of the chartValueSelectedListener of your PieChart:

ValueAnimator.ofFloat(0f, 1f).apply { duration = 200 addUpdateListener { pieDataSet.selectionShift = it * 8f pieChartView.invalidate() } start() }