Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi I have used dotnet charting website do a charting and I dont' know how to delete the default sentences inside the chart.

What I have tried:

C#
<pre>void Page_Load(Object sender, EventArgs e)
        {   
            Chart.TitleBox.Label.Text = "Student Progress";
            Chart.Width = 750;
            Chart.Height = 550;
            SeriesCollection mySC = Calculate();
            Chart.XAxis.Label.Text = "Marks";
            Chart.YAxis.Label.Text = "No of Students";
            Chart.SeriesCollection.Add(Calculate());
           
        }

        SeriesCollection Calculate()
        {
            SeriesCollection SC = new SeriesCollection();
            Random myR = new Random(1);
            for (int a = 0; a < 4; a++)
            {
                Series s = new Series();
                s.Name = "Series " + a.ToString();
                for (int b = 1; b < 5; b++)
                {
                    Element e = new Element();
                    e.Name = "Element " + b.ToString();
                    e.YValue = myR.Next(50);
                    s.Elements.Add(e);
                }
                SC.Add(s);
            } 
            SC[0].Element.Color = Color.FromArgb(49, 255, 49);
            SC[0].Elements[0].Name = "English";
            SC[0].LegendEntry.Value = "13";
            SC[0].LegendEntry.Name = "10-15";
            
            SC[1].Element.Color = Color.FromArgb(255, 255, 0);
            SC[1].Elements[0].Name = "Maths";
            SC[1].LegendEntry.Value = "32";
            SC[1].LegendEntry.Name = "10-40";
            
            SC[2].Element.Color = Color.FromArgb(255, 99, 49);
            SC[2].Elements[0].Name = "Science";
            SC[2].LegendEntry.Value = "6";
            SC[2].LegendEntry.Name = "0-10";
            
            SC[3].Element.Color = Color.FromArgb(0, 156, 255);
            SC[3].Elements[0].Name = "Computer";
            SC[3].LegendEntry.Value = "18";
            SC[3].LegendEntry.Name = "15-30";
            return SC;
        }
Posted
Updated 2-Mar-17 0:37am
v3
Comments
Afzaal Ahmad Zeeshan 1-Mar-17 8:09am    
Which default characters? And why you cannot remove them?
Member 12605293 1-Mar-17 8:33am    
Hey Afzaal,I have used the example in www.dotnetCharting.com I has the default sentences in it and I need to edit or reomve it for my work.I dont know where to change
[no name] 2-Mar-17 2:41am    
What do you mean by deleting the default statements inside a chat? can you please update your question with specific information so that anyone can understand your requirement properly and help you out in resolving your issue.

1 solution

Your question is a bit vague... I'll take a stab at it though...
C#
while (chart1.Series.Count > 0) { chart1.Series.RemoveAt(0); }
 
Share this answer
 
Comments
Member 12605293 2-Mar-17 6:41am    
Hi Graeme
Thanks for your reply.I am using
Chart.SeriesCollection.Add(Calculate()); but it show my chart as well as Chart.DefaultSeries..... in the output
Graeme_Grant 2-Mar-17 6:44am    
Did you try using it before loading your data?
Member 12605293 2-Mar-17 6:49am    
Int the above snippet ,which has the datas From which I am getting the default one
Graeme_Grant 2-Mar-17 6:50am    
I meant, did you try my code before you run yours to remove the default/any series?
Graeme_Grant 2-Mar-17 23:03pm    
How did you go?

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