Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I am drawing a Chart on Windows Form using C# and chart is using Database Table.
Can anyone please tell me, what is the easiest way to refresh the chart as more data is inserted into a database ?
Posted
Updated 22-Feb-19 0:14am

Hi,
Have you tried the ".Update()"?
it will be something like
C#
chart1.Update();


Jegan

[Edit]chart1.UpDate(); changed into chart1.Update(); (C# is case-sensitive)[/Edit]
 
Share this answer
 
v3
It is working for me:
Chart1.DataBind()
 
Share this answer
 
I have created a simple chart ,when i update the values,the corresponding value should update in my chart without using Cahrt1.Update or chart1.Refresh();

can you give solution for this
 
Share this answer
 
Comments
Member 10598526 14-Jul-17 11:35am    
Both are not working
Every time you add a point to the series the chart will automatically update itself,
the thing is that you are updating the chart from a different thread so you need to invoke the operation like this :

private void UpdateChart()
{
if (chart1.InvokeRequired)
{
chart1.Invoke(new Action(() =>
{
UpdateChart();
}
));
}
else
{
chart1.Series[0].Points.AddXY(100,200);
}

}
 
Share this answer
 
Comments
Richard Deeming 17-Jul-18 13:15pm    
Asked, answered, and solved FIVE YEARS AGO.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900