Solved

Data points insertion error. Only 1 Y values can be set for this data series

Posted on 2013-06-12
7
1,385 Views
Last Modified: 2013-11-11
Hi,

I am creating the spider chart using following data

SourceData:
Subject 	Marks
S1	70
S2	50
S3	66
S4	87
S5	70
S6	87
S7	77

Chart1.DataSource = SourceData;
for (int a = 1; a < SourceData.Columns.Count; a++)
                {
                    String strProdName = SourceData.Columns[a].ColumnName;&#9;
                    Chart1.Series.Add (strProdName);  //Name of the series  
                    Chart1.Series[strProdName].YValueMembers = strProdName;  
                    Chart1.Series[strProdName].XValueMember = SourceData.Columns[0].ColumnName;  
                    Chart1.Series[strProdName].ChartType = SeriesChartType.Radar;

                     
                    Chart1.Series[strProdName].BorderWidth = 3;
                    Chart1.Series[strProdName].Enabled = true;
                    Chart1.Series[strProdName].BorderColor = Color.FromArgb(randonGen.Next(255), randonGen.Next(255), randonGen.Next(255));
                    Chart1.Series[strProdName]["RadarDrawingStyle"] = "Line";
                }

                Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;              
                Chart1.ChartAreas[0].AxisY.LineWidth = 1;

                 //Bind the datasource
                Chart1.DataBind();


While binding the data to chart control I am getting the following error
System.ArgumentOutOfRangeException: Data points insertion error. Only 1 Y values can be set for this data series.
Parameter name: dataSource


Any ideas?
0
Comment
Question by:sam_net
  • 3
  • 2
7 Comments
 

Author Comment

by:sam_net
ID: 39256157
Hi,

Any help on this issue?

Thanks.
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 39256184
Could it be a problem in your SourceData? I tried with this and it works!
DataTable SourceData = new DataTable();
SourceData.Columns.AddRange(new DataColumn[]{new DataColumn("Subject", typeof (string)), new DataColumn("Marks", typeof (int))});
SourceData.Rows.Add(new object[]{"S1",70});
SourceData.Rows.Add(new object[]{"S2",50});
SourceData.Rows.Add(new object[]{"S3",66});
SourceData.Rows.Add(new object[]{"S4",87});
SourceData.Rows.Add(new object[]{"S5",70});
SourceData.Rows.Add(new object[]{"S6",87});
SourceData.Rows.Add(new object[]{"S7",77});

Open in new window

chart
0
 

Author Comment

by:sam_net
ID: 39260619
Thanks for reply.

But i need  solution for the above issue(System.ArgumentOutOfRangeException: Data points insertion error. Only 1 Y values can be set for this data series.
Parameter name: dataSource).

 Let me know how to avoid this issue.


Thanks.
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39260953
I understand but what I'm trying to say is that your posted code is not the problem per se. How is SourceData actually filled in your code?
0
 

Author Closing Comment

by:sam_net
ID: 39640721
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This video teaches users how to migrate an existing Wordpress website to a new domain.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question