Giter VIP home page Giter VIP logo

treemapkit's Introduction

TreemapKit

TreemapKit is a treemap implementation for Cocoa Touch. You can display treemaps in iPhone, iPod touch and iPad.

Click here to see the simple demo app

License

TreemapKit is provided under the MIT License.

How to use

  1. Copy TreemapKit folder to your source tree and add it to Xcode project.
  2. Import "TreemapView.h" from your code.
  3. Implement both TreemapViewDataSource and TreemapViewDelegate protocols.

Class References

TreemapView

reloadData

- (void)reloadData

Reload the data of the treemap.

Call this method to reload all the data that is used to construct the treemap including cells. If you want to change the cell content, implement treemapView:updateCell:forIndex:forRect:.

TreemapViewCell

A basic implementation of the treemap cell. You can make a sub-class to show more information or images.

textLabel

UILabel *textLabel

The label used for the main textual content of the tremap cell.

valueLabel

UILabel *valueLabel

The label used to show a value of the cell.

index

NSinteger index

The cell index.

initWithFrame:

- (id)initWithFrame:(CGRect)frame

Initialize the cell with a frame.

TreemapViewDataSource

The data source protocol for a TreemapView object.

valuesForTreemapView: (required method)

- (NSArray *)valuesForTreemapView:(TreemapView *)treemapView;

Provides data for a TreemapView as a NSArray.

Tree or other data structures are currently not supported.

TreemapView:cellForIndex:forRect: (required method)

- (TreemapViewCell *)treemapView:(TreemapView *)treemapView cellForIndex:(NSInteger)index forRect:(CGRect)rect;

Returns a cell object for the specified place. You need to create a TreemapViewCell and return it.

treemapView:separatorWidthForDepth:

- (float)treemapView:(TreemapView *)treemapView separatorWidthForDepth:(NSInteger)depth;

Returns a separator width for the specified depth. If you don't need to change the width for the specified depth, return 0. The default separator width is 0.

treemapView:separationPositionForDepth:

- (NSInteger)treemapView:(TreemapView *)treemapView separationPositionForDepth:(NSInteger)depth;

Normally TreemapView separate two rectangles with calculating the areas, but if you want to separate two groups manually, return the index of the cells. If you don't need to change the separation position for the specified depth, return NSIntegerMax.

TreemapViewDelegate

The delegate of a TreemapView object.

treemapView:tapped:

- (void)treemapView:(TreemapView *)treemapView tapped:(NSInteger)index;

Tells the delegate that the specified cell is tapped.

treemapView:updateCell:forIndex:forRect:

- (void)treemapView:(TreemapView *)treemapView updateCell:(TreemapViewCell *)cell forIndex:(NSInteger)index forRect:(CGRect)rect;

Tells the delegate that the specified cell should be updated. You need to update the cell content manually in this method.

Links

treemapkit's People

Contributors

yatsu avatar obrizan avatar

Watchers

James Cloos avatar githow avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.