Add a RadTreeMap and use the following code snippet:
Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim g1 As TreeMapDataItemGroup = New TreeMapDataItemGroup() With {.LegendTitle = "Project A", .Text = "Project A"}
Dim g2 As TreeMapDataItemGroup = New TreeMapDataItemGroup() With {.LegendTitle = "Project B", .Text = "Project B"}
Dim g3 As TreeMapDataItemGroup = New TreeMapDataItemGroup() With {.LegendTitle = "Project C", .Text = "Project C"}
Me.RadTreeMap1.Groups.AddRange(New Telerik.WinControls.UI.TreeMap.TreeMapDataItemGroup() {g1, g2, g3})
Dim i1 As TreeMapDataItem = New TreeMapDataItem() With {.Group = g1, .Text = "Element 1", .Value = 3}
Dim i2 As TreeMapDataItem = New TreeMapDataItem() With {.Group = g1, .Text = "Element 2", .Value = 5}
Dim i3 As TreeMapDataItem = New TreeMapDataItem() With {.Group = g2, .Text = "Element 3", .Value = 0}
Dim i4 As TreeMapDataItem = New TreeMapDataItem() With {.Group = g2, .Text = "Element 4", .Value = 13}
Dim i5 As TreeMapDataItem = New TreeMapDataItem() With {.Group = g1, .Text = "Element 5", .Value = 3}
Me.RadTreeMap1.Items.AddRange(New Telerik.WinControls.UI.TreeMap.TreeMapDataItem() {i1, i2, i3, i4, i5})
Me.RadTreeMap1.ShowLegend = True
Me.RadTreeMap1.TreeMapElement.LegendPosition = RadPosition.Right
Me.RadTreeMap1.TreeMapElement.LegendElement.LegendTitle = "Projects"
Me.RadTreeMap1.TreeMapElement.LegendElement.PanelElement.Orientation = Orientation.Vertical
End Sub
Expected result:
Actual result:
Workaround: move the the code to the form's constructor. Alternatively, make the legend visible:
Me.RadTreeMap1.TreeMapElement.LegendElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
RadTreeMap supports grouping which allows you to add a TreeMapGroupDescriptor for a certain property name. For example if you have the Products table and group it by CategoryID, the following groups will be added:
If you want to group by a second or N-th property to build N-level of grouping, it would be nice to have this functionality.