Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi ,

Is it possible to edit graph on runtime?
I am using .net chart controls for displaying a line graph.I would also like to add points to the graph during runtime and save to the sql server database.is there a way to do this ?

thanks
Posted

Yes, you can add points to a MS Chart control at runtime. Use something like the following code.

C#
public Chart myChart;

//initialize chart ....

//new data
double newX = 20.0;
double newY = 10.25;

int currentSeries = 0;//set to the series to which you want to add points
myChart.Series[currentSeries].Points.AddXY(newX , newY);
 
Share this answer
 
Comments
DepiyaReddy 11-Apr-12 20:43pm    
thanks
VJ Reddy 22-May-12 10:31am    
Good answer. 5!
BillW33 23-May-12 7:09am    
Thanks, VJ.
Is there a property to zoomin and zoomout using .net chart controls.I read some articles stating only Windows Forms control you can enable zooming and scrolling whereas ASP.NET chart control doesnt support zooming and scrolling.
But I am using webforms(System.Web.UI.DataVisualization.Charting).So is it possible?if so i need the code plz.
 
Share this answer
 
Comments
BillW33 23-May-12 10:03am    
You should not post a question as a "Solution". Either add a comment to a previous solution by pressing the "Have a Question or Comment?" button or post a new question. Posting a question in a solution, besides being bad form, can cause your question to be missed.
DepiyaReddy 31-May-12 19:57pm    
ohh sorry about that..thanks
In answer to the question in Solution 2. The MS Chart Controls allow zooming and scrolling for WinForms, but not for ASP.NET; see this article[^].
Also, to learn more about MS Charts take a look at these links[^] for MS Chart Controls. You especially should DL and try out the ASP.NET samples found here[^].
 
Share this answer
 
Comments
DepiyaReddy 31-May-12 19:57pm    
thanks .

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