Hi Team,
I am trying to create a chart based on my datagrid. My datagrid contains bound and unbound columns, i have succesfully been apple to display the bound columns in the chart and unfortunately not been able to do the same for the unbound columns.
i have read
How to create a pie chart from a datagridview for specific columns[
^]
to see if i can assign to my chart specific columns to display. But unfortunaly not benn able to do so.
any suggestion on how display both bound and unbound datagrid columns to chart?
What I have tried:
I did try to fetch my gridview data and save to datatable like seen below:
private void chdata()
{
DataTable dt = new DataTable();
foreach (GridColumn column in ProdgridView.VisibleColumns)
{
dt.Columns.Add(column.FieldName, column.ColumnType);
}
for (int i = 0; i < ProdgridView.DataRowCount; i++)
{
DataRow row = dt.NewRow();
foreach (GridColumn column in ProdgridView.VisibleColumns)
{
row[column.FieldName] = ProdgridView.GetRowCellValue(i, column);
}
dt.Rows.Add(row);
ProdchartControl.DataSource = dt;
ProdchartControl.Series["ProdA"].ArgumentDataMember = "Prod_Date";
ProdchartControl.Series["ProdA"].ValueDataMembers.AddRange("AProd");
}
}
but i get the error: System.NotSupportedException: 'DataSet does not support System.Nullable<>.' when trying to use the converted datagridview to Datatable as my chart datasource.
Any suggestion would be appreciated.
Regards.