What is YMTreeMap?

YMTreeMap is a high performance treemap layout engine for iOS and macOS, written in Swift.

The input to YMTreeMap is a list of arbitrary numbers, and the output will be a list of layout rectangles representing those numbers graphically. The order of the layout rectangles will match the original input order, so you should sort the input numbers the way that you want your treemap to be ordered. Finally, the size of the layout rectangles will represent the relative weighting of the ordinal input number that it cooresponds to.

YMTreeMap uses the “squarified” layout treemap algorithm. Squarified optimizes for low aspect ratios: meaning it generates rectangles that are as square as possible given a reasonable effort. While not perfectly optimal, the algorithm get pretty close while maintaining high-performance.

The output rectangles can easily be used to render the shapes using whatever rendering system you prefer:

  • Using CoreGraphics (in drawRect, etc)
  • Using OpenGL

Using a custom UICollectionView layout

Overview

  • Pricing: Free
  • Resource Link: https://github.com/yahoo/YMTreeMap
  • Resource Maker: Yahoo
  • Mobile Platform Destination: iOS Apps
  • Mobile Platform Support: Native iOS
  • Programming Languages: Swift
  • CocoaPods: YMTreeMap