Working with Data > Copying Data |
Before you can create a chart, you must provide it with data. ComponentOne Chart provides users with 2 different methods that allow you to copy data arrays directly to and from the chart, making it easy to quickly create chart data.
Note: the methods defined in this section only apply to Grid, and Irregular Grid data formats, and cannot be used with the Point data format.
The following copying data methods are defined by the Chart3DData Object:
CopyZArrayIn(array)
Copies an array (array) to the Z values for a chart. array must be a two-dimensional array of singles, doubles, longs or integers.
CopyZArrayOut(array)
Copies the Z values from the chart into an array. array must be a two-dimensional array of singles, doubles, longs or integers.
The following example initializes an array, MyArray, populates it with data, and copies the array to the chart using CopyZArrayIn:
' Create the array
Dim MyArray(1 To 200, 1 To 4) As Double
Chart3D1.IsBatched = True
' Set the number of rows and columns
Chart3D1.ChartGroups(1).ElevationData.RowCount = 200
Chart3D1.ChartGroups(1).ElevationData.ColumnCount = 4
' Populate the array
For i = 1 To 4
For j = 1 To 200
Select Case x
Case 1, 3
x(i, j) = i * 5 * Rnd + Sqr(2 * j * j * i)
Case Else
x(i, j) = i * -5 * Rnd + Sqr(2 * j * i)
End Select
Next j
Next i
' Copy the array to the chart
Chart3D1.ChartGroups(1).ElevationData.CopyZArrayIn MyArray
Chart3D1.IsBatched = False