Question

I am trying to get one point of a Chart in C# Visual Studio 2010 using the following code:

chart1.Series[0].Points.Item[1]

but I get the following error:

Error 1 'System.Windows.Forms.DataVisualization.Charting.DataPointCollection' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Windows.Forms.DataVisualization.Charting.DataPointCollection' could be found (are you missing a using directive or an assembly reference?)

But supposedly Points being a DataPointCollection should have the property Item as is shown on Microsoft's webpage:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.datapointcollection.aspx

What am I doing wrong?

Était-ce utile?

La solution

Surely, since Points is the collection, you should be doing:

chart1.Series[0].Points[1].Item
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top