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.
Unfortunately, activation email could not send to your email. Please try again.

Update chart on data change

Thread ID:

Created:

Updated:

Platform:

Replies:

94067 Apr 20,2010 04:29 PM May 20,2010 08:28 AM ASP.NET Web Forms (Classic) 5
loading
Tags: Chart
Dan Schubel
Asked On April 20, 2010 04:29 PM

I have a line chart that is using a BindingList as a data source. The same BindingList is also the data source for ms-datagridview on the same form.
What so I need to do to get the chart to reflect any edits made to the data source via the datagridview.
I have tried chart1.Update(), chart1.Refresh(), chart1.Redraw.
Am I missing something obvious?

p.s.
I have verified that the BindingList's data is actually changing

Jaffersathick B [Syncfusion]
Replied On April 26, 2010 01:58 PM

Hi DanSChubel,

Thank you for using Syncfusion products.

I am afraid, that I was unable to reproduce this issue. Could you please have a look on the below online sample and if the issue still exists, try to reproduce in a simple sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution.

Sample link:

http://samples.syncfusion.com/ASPNET/8.2.0.18/Web/Chart.Web/samples/3.5/Data%20Binding/CustomCollections/CS/CustomCollections.aspx?args=9


Let me know if you have any concerns.

Regards,
Jaffer.B


Dan Schubel
Replied On May 18, 2010 01:16 PM

I added a button to the Windows Forms "Custom Collections" sample and I am able to update the chart when the source data changes via this code:
private void buttonAdv1_Click(object sender, EventArgs e)
{
bindList[0].Population = 500;

ChartDataBindModel dataSeriesModel = new ChartDataBindModel(bindList);
dataSeriesModel.YNames = new string[] { "Population" };
chartControl2.Series[0].SeriesModel = dataSeriesModel;
}

But this leaves me with some questions...
Why is it necessary to reassign the ChartDatabindModel?
I have other code where data is added to the bindinglist that serves as the chart's datasource via a timer, and the chart updates automatically with no additional code.
I'm curious what the Update, Refresh, and Redraw methods do. I have been searching the documentation for a description of them, but haven't found anything.

Jaffersathick B [Syncfusion]
Replied On May 19, 2010 03:04 AM

Hi DanSchubel,

Thanks for the update.

Instead of binding the data again we suggest you to update the binding list and reset the particular row of the list.

Please refer the following code snippet:

[CS]
private void button1_Click(object sender, EventArgs e)
{
bindList[0].Population = 500;
bindList.ResetItem(0);
}


Let me know if it helps.

Regards,
Jaffer.B


Dan Schubel
Replied On May 19, 2010 09:54 AM

That works, thanks!

Jaffersathick B [Syncfusion]
Replied On May 20, 2010 08:28 AM

Hi DanSchubel,

Thanks for the update.

We are glad to hear that your issue is resolved.

Please do not hesitate to get back to us for further assistance.

Regards,
Jaffer

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;