We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Chart Grid Interaction

Could you provide me with a sample where the chart uses a GridDataGridView as its data source?
(My datasource for the grid is a Bindinglist)
Thanks

6 Replies

JB Jaffersathick B Syncfusion Team July 22, 2010 05:33 AM UTC

Hi Dan,

Thank you for using Syncfusion products.

We suggest you to rebind the data bindings of the chart control to update the edited data. You can use Grid grouping controls “SourceListListChanged” event to achieve this.

Please refer the following code snippet:

[CS]
void gridGroupingControl1_SourceListListChanged(object sender, Syncfusion.Grouping.TableListChangedEventArgs e)
{
setbindings();
}

private void setbindings()
{
ChartSeries series = this.chartControl1.Series[0];
this.chartControl1.DataBindings.Clear();
ChartDataBindModel dataSeriesModel = new ChartDataBindModel(bindList);

// If ChartDataBindModel.XName is empty or null, X value is index of point.
dataSeriesModel.YNames = new string[] { "Population" };
series.SeriesModel = dataSeriesModel;
}


Note: Due to security reason we are unable to provide the sample in public forums.

Let me know if you have any other concerns.

Regards,
Jaffer


DS Dan Schubel July 22, 2010 02:00 PM UTC

The info on this page ( http://www.syncfusion.com/products/user-interface-edition/aspnet/chart/chart-and-grid-interaction ) gives me the impression that the chart can use the grid as its data source and the two controls can be synchronized. Is that mot the case?


MC Manickam Chidambaram Syncfusion Team July 27, 2010 02:35 PM UTC

Hi Dan,

Thanks for your update.

We are currently working on your requirements and we will provide you the update within one business day.
Please let me know if any concerns.

Regards,
Manickam



JB Jaffersathick B Syncfusion Team July 28, 2010 03:56 PM UTC

Hi Dan,

Thank you for your patience.

Since you are binding a binding list to the grid it should be reset its bindings using “ResetBindings” function of the Binding list after the grid is edited.

Please refer the following code snippet:

[CS]

void TableControl_CurrentCellEditingComplete(object sender, EventArgs e)
{
list.ResetBindings();
}


Please refer the sample from the following link:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Sample75482368.zip

Let me know it helps.

Regards,
Jaffer.B


DS Dan Schubel August 2, 2010 02:41 PM UTC

I've looked at your sample and I've actually tried something similar with my project.
I am still getting into a situation where the grid and the chart show different data. (See attached).
I achieve this by selecting the product price column of the first row, entering a value of 1 and pressing the enter key. Then navigating to a different cell using the arrow keys.
The CurrentCellEditingComplete event fires when enter is pressed but the chart doesn't display the new value. It appears to me that the new value is not getting written back to the bindinglist until moving to a new row?




GridEdit1_5e368ce3.zip


MC Manickam Chidambaram Syncfusion Team August 6, 2010 09:15 AM UTC

Hi Dan,

Thank you for your patience.

To update the Chart with the changes made in Grid can be achieved by Grid Control’s event “SourceListRecordChanged”. Please refer the code snippet below.

[CodeBehind-C#]

//Adding the event handler for SourceListRecordChanged
this.gridGroupingControl1.SourceListRecordChanged += new Syncfusion.Grouping.RecordChangedEventHandler(gridGroupingControl1_SourceListRecordChanged);

void gridGroupingControl1_SourceListRecordChanged(object sender, Syncfusion.Grouping.RecordChangedEventArgs e)
{
list.ResetBindings();
}

Please refer the sample from the following link:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=Sample-1504075913.zip

Please try using the above sample and let me know if any concerns.

Regards,
Manickam

Loader.
Live Chat Icon For mobile
Up arrow icon