Hello,
I am new to Syncfusion components and especially the treemap control
I am trying to generate a treemap from a datatable with the following code (VB.NET on .NET Framework 4.5)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim dtDashboard As DataTable = New DataTable
dtDashboard.Columns.Add("Continent", Type.GetType("System.String"))
dtDashboard.Columns.Add("Country", Type.GetType("System.String"))
dtDashboard.Columns.Add("Users", Type.GetType("System.Int32"))
dtDashboard.Rows.Add("Europe", "France", 13)
dtDashboard.Rows.Add("Europe", "Germany", 8)
dtDashboard.Rows.Add("Europe", "Switzerland", 7)
dtDashboard.Rows.Add("Asia", "Singapore", 5)
dtDashboard.Rows.Add("Asia", "Thailand", 2)
TreeMap1.ItemsSource = dtDashboard 'fails with the below error message
Dim tmft1 As New TreeMapFlatLevel
tmft1.GroupPath = "Continent"
tmft1.ShowLabels = True
TreeMap1.Levels.Add(tmft1)
Dim tmft2 As New TreeMapFlatLevel
tmft2.GroupPath = "Country"
tmft2.ShowLabels = True
TreeMap1.Levels.Add(tmft2)
TreeMap1.WeightValuePath = "Users"
End Sub
-----------------------
error message
System.ArgumentNullException was unhandled
HResult=-2147467261
Message='name' argument cannot be null.
Parameter name: name
ParamName=name
Source=System.Data
StackTrace:
at System.Data.DataColumnCollection.get_Item(String name)
at System.Data.DataRowView.get_Item(String property)
at Syncfusion.Windows.Forms.TreeMap.TreeMapEngine.GetGroupItem(String field, String labelPath)
at Syncfusion.Windows.Forms.TreeMap.TreeMap.GenerateTreeMapItems()
at Syncfusion.Windows.Forms.TreeMap.TreeMap.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
InnerException:
----
I just can not figure out which missing 'name' the error is referencing
The same datatable loads fine in a datagridview
Any pointer much apreciated
Best regards,
Cyril