BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Kumar,
Thank you for reaching out to us. We have analyzed your query and found that we can bind a data table to the ItemSource of the pivot chart is possible by inheriting DataView. The following code snippet demonstrates how to inherit the DataView class, which connects the view to its corresponding DataTable, to bind the data table to the pivot chart.
pivotChart1.ItemSource = ProductSalesObjectsDataView.GetDataTable(); |
The sample file also includes a DataTable collection view code snippet that demonstrates how to create the DataTable and add the data to it.
public class ProductSalesObjectsDataView : DataView { public static DataView GetDataTable() { DataTable dataTable = new DataTable("ProductSalesObjectsDataView"); PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(typeof(ProductSales));
foreach (PropertyDescriptor propertyDescriptor in propertyDescriptorCollection) { dataTable.Columns.Add(new DataColumn(propertyDescriptor.Name, propertyDescriptor.PropertyType)); }
ProductSalesCollection productSalesObjectCollection = ProductSales.GetSalesData();
foreach (ProductSales businessObject in productSalesObjectCollection) { DataRow dataRow = dataTable.NewRow(); foreach (PropertyDescriptor propertyDescriptor in propertyDescriptorCollection) { dataRow[propertyDescriptor.Name] = propertyDescriptor.GetValue(businessObject); } dataTable.Rows.Add(dataRow); }
return dataTable.DefaultView; }
} |
Please refer to the following documentation for more information on data binding the pivot chart.
https://help.syncfusion.com/windowsforms/pivot-chart/getting-started#binding-data
https://help.syncfusion.com/windowsforms/pivot-grid/data-binding#binding-data-from-data-table
Please let me know if you have any further assistance. We are here to help.
Regards,
Nanthini Mahalingam.