
You need to use simple logic to implement the above funnel diagram.
There are 5 elements: A1, A2, A3, A4, A5 and a funnel height of 200 .
& & A1 = 30%, A2 = 25%, A3 = 20%, A4 = 15% and A5 = 10%
Now distritribute items according to height % in funnel. So A1 = 0.3*200 = 60 A2 = 0.25*200 = 50 A3 = 0.2*200 = 40 A4 = 0.15*200 = 30 A5 = 0.1*200 = 20 -------------------- Total = 200 On the basis of above calculated height:- 5 different BezierPath can be drawn . Above data can be generalised to 'n' items and 'x' Height .
Logic in Height Distribution Calculation
class HeightDistribution { class func height(percentages: [Float] , TotalHeight:Float ) -> [Float] { var heights = [Float]() for percentage in percentages { let height = (percentage/100)*TotalHeight heights.append(height) } return heights } }
Advanced demo application. Swift3
source share