Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 1880 |  Welcome, Guest!   Register  Login
 Home > Blogs > Windows Forms > SeriesCollection ...
Jvprabhusanthi

SeriesCollection

 Blog author: Jvprabhusanthi | Posted on: 5/3/2012 | Category: Windows Forms Blogs | Views: 599 | Status: [Member] | Points: 75 | Alert Moderator   
Ads

A chart element with the name already exists in the 'SeriesCollection'.

While working with Charting control in Windows forms. I found an issue in binding and rebinding the data into the chart control.

Here is the small piece of code to plot the data in a chart

string[] seriesArray = { "Semester1", "Semester2", "Semester3" };



int[] pointsArray = { Convert.ToInt32(0), Convert.ToInt32(semester[1]), Convert.ToInt32(semester[2]) };




this.chart1.Palette = ChartColorPalette.Berry;



this.chart1.Titles.Add("Growth of the Student");



for (int x = 0; x < seriesArray.Length; x++)


{




Series series = this.chart1.Series.Add(seriesArray[x]);


series.Points.Add(pointsArray[x]);


} 
  
  
While loading the data for the second time, i got an error "A chart element with the name already exists in the 'SeriesCollection'." The reason is, the chart is already having the series related data bound to it. 
  
Solution: 
  
chart1.Series.Clear(); 



chart2.Series.Clear();


chart3.Series.Clear();


this.chart1.Titles.Clear();


this.chart2.Titles.Clear();


this.chart3.Titles.Clear(); 
  
Cheers, 
Venkatesan prabu .J 
Head, KaaShiv InfoTech



Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech
http://kaashivinfotech.com/Ebooks.aspx
Found interesting? Add this to:


Experience:9 year(s)
Home page:http://www.dotnetfunda.com
Member since:Tuesday, May 01, 2012
Level:Starter
Status: [Member]
Biography:
>> Write Response - Respond to this post and get points

More Blogs

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 12:38:20 PM