Inherits from NSObject
Conforms to IGTreemapViewDataSource
Declared in IGTreemapViewDataSourceHelper.h

Overview

This is the helper class that will create a hierarchical tree of nodes from a given data object. The data supplied to the helper is typically a custom business object containing various properties and an array of other business objects. The nodes at each level of the treemap can be bound to a numeric property for the nodes' values and a string property for the nodes' labels.

This helper allows to create treemap nodes one level at a time. Each level is created based on a value path, label path and a childSourcePath. Value and label path properties are used to set the node’s value and label. ChildSourcePath is the name of the array property that contains the node’s children. Having a valid childSourcePath doesn’t necessarily make the node create its children, but prepares the node’s data context if the children need to be created in the future.

Tasks

Other Methods

  •   data

    Reference to the data model used to populate the treemap view.

    property
  •   treemapView

    Reference to the treemap view.

    property

Initializing the datasource helper

  • – initWithData:treemapView:

    Creates a new instance of the data source helper with data and the treemap reference.

  • – addLevelWithValuePath:labelPath:childSourcePath:

    Creates a new level of child nodes in the treemap.

  • – setValuePath:labelPath:forLevel:

    Updates node information at a given level. This method can be used to change the values and labels of the treemap nodes at a given level of depth. The treemap needs to call its refresh method for the visuals to update.

  • – addData:parent:

    Adds a new node to the treemap. This method should be used to add new nodes to the treemap after a new data object has been added to the hierarchy. Note that this method will not automatically create child nodes. This method must be called for each added data object and for each added sub object.

  • – insertData:index:parent:

    Inserts a new node to the treemap at a specified index. This method should be used to insert new nodes to the treemap after a new data object has been inserted into the hierarchy. Note that this method will not automatically create child nodes. This method must be called for each added data object and for each added sub object.

  • – replaceWithData:oldData:

    Replaces an existing node with a new one. This method should be used to replace an existing node representing oldData parameter. Note that this method will not automatically create child nodes if the new data object has children. addData or insertData methods should be used for each subitem of the new data object.

  • – replaceWithData:index:parent:

    Replaces an existing node with a new one at a specified index. This method should be used to replace an existing node at a specified index. Note that this method will not automatically create child nodes if the new data object has children. addData or insertData methods should be used for each subitem of the new data object.

  • – removeData:

    Removes an existing node based on a given data object.

  • – removeDataAtIndex:parent:

    Removes an existing node at a specified index.

Properties

data

Reference to the data model used to populate the treemap view.

@property (nonatomic, retain) NSObject *data

Declared In

IGTreemapViewDataSourceHelper.h

treemapView

Reference to the treemap view.

@property (nonatomic, weak) IGTreemapView *treemapView

Declared In

IGTreemapViewDataSourceHelper.h

Instance Methods

addData:parent:

Adds a new node to the treemap. This method should be used to add new nodes to the treemap after a new data object has been added to the hierarchy. Note that this method will not automatically create child nodes. This method must be called for each added data object and for each added sub object.

- (void)addData:(NSObject *)dataItem parent:(NSObject *)parent

Parameters

dataItem

A new data object that was added to the underlying data hierarchy.

parent

Parent object containing the dataItem parameter. If parent param in nil, the node will be added to the root.

Declared In

IGTreemapViewDataSourceHelper.h

addLevelWithValuePath:labelPath:childSourcePath:

Creates a new level of child nodes in the treemap.

- (void)addLevelWithValuePath:(NSString *)valuePath labelPath:(NSString *)labelPath childSourcePath:(NSString *)childSourcePath

Parameters

valuePath

Numeric property name that will be used for the nodes' values.

labelPath

String property name that will be used for the nodes' labels.

childSourcePath

Array property name that will be used for the nodes' children.

Declared In

IGTreemapViewDataSourceHelper.h

initWithData:treemapView:

Creates a new instance of the data source helper with data and the treemap reference.

- (id)initWithData:(NSObject *)data treemapView:(IGTreemapView *)treemapView

Parameters

data

Data model used to populate the treemap.

treemapView

Reference to the treemap view.

Declared In

IGTreemapViewDataSourceHelper.h

insertData:index:parent:

Inserts a new node to the treemap at a specified index. This method should be used to insert new nodes to the treemap after a new data object has been inserted into the hierarchy. Note that this method will not automatically create child nodes. This method must be called for each added data object and for each added sub object.

- (void)insertData:(NSObject *)dataItem index:(NSInteger)index parent:(NSObject *)parent

Parameters

dataItem

A new data object that was added to the underlying data hierarchy.

parent

Parent object containing the dataItem parameter. If parent param in nil, the node will be added to the root.

Declared In

IGTreemapViewDataSourceHelper.h

removeData:

Removes an existing node based on a given data object.

- (void)removeData:(NSObject *)dataItem

Parameters

dataItem

The data object that was removed from the hierarchy.

Declared In

IGTreemapViewDataSourceHelper.h

removeDataAtIndex:parent:

Removes an existing node at a specified index.

- (void)removeDataAtIndex:(NSInteger)index parent:(NSObject *)parent

Parameters

index

Index, at which to remove a node.

parent

The data object containing the object that was removed.

Declared In

IGTreemapViewDataSourceHelper.h

replaceWithData:index:parent:

Replaces an existing node with a new one at a specified index. This method should be used to replace an existing node at a specified index. Note that this method will not automatically create child nodes if the new data object has children. addData or insertData methods should be used for each subitem of the new data object.

- (void)replaceWithData:(NSObject *)dataItem index:(NSInteger)index parent:(NSObject *)parent

Parameters

dataItem

A new data object that replaced the old data object.

index

Index, at which the data was replaced.

parent

The data object containing the object that was replaced.

Declared In

IGTreemapViewDataSourceHelper.h

replaceWithData:oldData:

Replaces an existing node with a new one. This method should be used to replace an existing node representing oldData parameter. Note that this method will not automatically create child nodes if the new data object has children. addData or insertData methods should be used for each subitem of the new data object.

- (void)replaceWithData:(NSObject *)dataItem oldData:(NSObject *)oldData

Parameters

dataItem

A new data object that replaced the old data object.

oldData

The old data object that was replaced.

Declared In

IGTreemapViewDataSourceHelper.h

setValuePath:labelPath:forLevel:

Updates node information at a given level. This method can be used to change the values and labels of the treemap nodes at a given level of depth. The treemap needs to call its refresh method for the visuals to update.

- (void)setValuePath:(NSString *)valuePath labelPath:(NSString *)labelPath forLevel:(NSInteger)level

Parameters

valuePath

New property name to use for the nodes' values.

labelPath

New property name to use for the nodes' labels.

level

Level of depth, at which the nodes will be changed.

Declared In

IGTreemapViewDataSourceHelper.h