Version

Set a Treemap Chart’s Color Based on Hierarchical Level

You can set the node colors in your treemap chart based on the hierarchical level of each node.

The order in which PaintElements are added to the collection represents which level of your treemap chart will be affected. For example, the first PE in the collection maps to the first level, the second PE in the collection maps to the second level and so on.

Based on the color, your end user can quickly see which level a particular node belongs to.

The following example code demonstrates how to display each parent node at level 1 as red and each node at level 2 as green.

Example of a Treemap Chart who's colors are set based on the hierarchical level.

In Visual Basic:

Me.ultraChart.TreeMapChart.PEs.Add
(New Infragistics.UltraChart.Resources.Appearance.PaintElement(System.Drawing.Color.Red))
Me.ultraChart.TreeMapChart.PEs.Add
(New Infragistics.UltraChart.Resources.Appearance.PaintElement(System.Drawing.Color.Green))

In C#:

this.ultraChart.TreeMapChart.PEs.Add
 (new Infragistics.UltraChart.Resources.Appearance.PaintElement
 (System.Drawing.Color.Red));
this.ultraChart.TreeMapChart.PEs.Add
 (new Infragistics.UltraChart.Resources.Appearance.PaintElement
 (System.Drawing.Color.Green));