Hi,
I'm using TreeMapChart chart type and it's behaving rather oddly. I bound the chart to a datatable and exclude columns that I don't want to display.
Here's the result that i get:
Here's the ouput when the table has 2 columns only:
Does anyone know if this behaviour is by design? I couldn't figure out why there's an extra circle with the first image. I guess the TreeMapChart doesn't refresh the data when the column has been excluded. I tried with bar chart and the it works fine.
I have sample code attached. I'm using V2009.2
Many thanks.
while it makes sense to try to exclude columns from the treemap in this way, column filtering works only on numeric columns, and treemap has its own way of filtering out data.
please use this code in your "ChartAllColumn" method:
Me.uChart.TreeMapChart.SizeValueIndex = 3 Me.uChart.TreeMapChart.IndexOrder = New Integer() {0}
this will ensure that the treemap gets its size values from the column at index 3, and it will get its label values from only column 0.
the problem you experienced was with the IndexOrder; it defaulted to use every string column, for a total of 2 columns, which resulted in an extra level in the data hierarchy.
Thanks David for your reply.
Still on the Treemap, when I switch the TreeMapStyle to 'Rectangle', I'm getting a bunch of small razor shape TreeMapSeries instead of rectangles. I'm wondering if I'm missing anthing in my code. You can find the code below.
Here's the result I got:
I'd expect result (rectagle blocks) to look similar to these:
Private Sub ChartTreeMapRect()
Dim dt As New DataTable
Dim col1 As New DataColumn("ID", GetType(String))
Dim col2 As New DataColumn("Value", GetType(Integer))
dt.Columns.AddRange(New DataColumn() {col1, col2})
Dim r As New Random
For i As Integer = 0 To 49
dt.Rows.Add(Guid.NewGuid.ToString, r.Next(0, 100))
Next
uChart.TreeMapChart.TreeMapType = Infragistics.UltraChart.Shared.Styles.TreeMapType.Rectangular
uChart.TreeMapChart.ShowLabels = False
Me.uChart.Data.DataSource = dt
Me.uChart.Data.DataBind()
End Sub
try setting the TreeMapChart.Margin property to zero. it won't change the layout algorithm that we're using, but it will make things easier to look at by eliminating all that blank space.
there are many known layout algorithms for treemaps, and currently we only provide one. if you'd like to see more treemap layouts available for a future release, please visit our feature request page: http://devcenter.infragistics.com/protected/requestfeature.aspx