The data for the point data format is accessed by series. A series can be added or removed using the Chart3DPointSeries Collection Editor at design time or programmatically using AddSeries and RemoveSeries method of the Chart3DDataSetPoint class. For more information on accessing the Chart3DPointSeries Collection Editor, see Chart3DPointSeries Collection Editor.
Individual series are accessed via the SeriesCollection property of the Chart3DDataSetPoint object. The number of points in the series can be determined via the read-only Count property.
The Points property of Chart3DPointSeries class gives access to the points array of the series. It returns array of Chart3DPoint that represent coordinates of data points. To set new data points for the series, assign Points property to the new array of Chart3Dpoint.
The following creates point dataset and adds two series to it:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim pointset As Chart3DDataSetPoint pointset = new Chart3DDataSetPoint() Dim len As Integer = 20 Dim i As Integer Dim points1(len) As Chart3DPoint Dim points2(len) As Chart3DPoint Dim c, s As Double For i = 0 To 20 c = Math.Cos(i * Math.PI * 2 / len) s = Math.Sin(i * Math.PI * 2 / len) points1(i) = New Chart3DPoint(s, c, 0) points2(i) = New Chart3DPoint(s, 0, c) Next pointset.AddSeries( points1) pointset.AddSeries( points2) ' transfer dataset to the chart and select scatterC1Chart3D1.ChartGroups(0).ChartData.Set = pointset C1Chart3D1.ChartGroups(0).ChartType = Chart3DTypeEnum.Scatter |
To write code in C#
C# |
Copy Code
|
---|---|
Chart3DDataSetPoint pointset = new Chart3DdataSetPoint(); int len =21; Chart3DPoint[] points1 = new Chart3DPoint[len]; Chart3DPoint[] points2 = new Chart3DPoint[len]; double c, s; for( int i=0; i<len; i++) { c = Math.Cos( i * Math.PI*2 / len); s = Math.Sin( i * Math.PI*2 / len); points1[i]=new Chart3DPoint(s, c, 0); points2[i]=new Chart3DPoint(s, 0, c); } pointset.AddSeries( points1); pointset.AddSeries( points2); // transfer dataset to the chart and select scatter C1Chart3D1.ChartGroups[0].ChartData.Set = pointset; C1Chart3D1.ChartGroups[0].ChartType = Chart3DTypeEnum.Scatter; |
The following sets up a new array of data points to the first series:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim pts(1) As Chart3DPoint pts(0) = New Chart3DPoint( 0, 0, -1) pts(1) = New Chart3DPoint( 0, 0, 1) pointset.SeriesCollection(0).Points = pts |
To write code in C#
C# |
Copy Code
|
---|---|
Chart3DPoint[] pts = new Chart3DPoint[2]; pts[0] = new Chart3DPoint( 0, 0, -1); pts[1] = new Chart3DPoint( 0, 0, 1); pointset.SeriesCollection[0].Points = pts; |