ComponentOne Chart 8.0 for ActiveX
Charting Data Directly From Your Program

 

Charting Data Directly From Your Program

Often it may not be convenient to load chart data from a file. For example, if the data is created from within the program using a mathematical calculation, it makes more sense to read it into the chart directly instead of saving it to a file and then reading it again. Not only can this method be quicker, it can also be quite easy to program.

The following example creates a 2-dimensional array, populates the array with data, and then copies the contents of the array to the chart's Z values:

' Create the array

Dim x(1 To 10000, 1 To 4) As Double

Chart3D1.IsBatched = True

 

' Set the number of rows and columns

Chart3D1.ChartGroups(1).ElevationData.RowCount = 10000

Chart3D1.ChartGroups(1).ElevationData.ColumnCount = 4

 

' Populate the array

For m = 1 To 4

       For n = 1 To 10000

              Select Case m

              Case 1, 3

                     x(n, m) = m * 5 * Rnd + Sqr(2 * m * m * n)

              Case Else

                     x(n, m) = m * -5 * Rnd + Sqr(2 * m * n)

              End Select

       Next n

Next m

 

' Copy the array to the chart

Chart3D1.ChartGroups(1).ElevationData.CopyZArrayIn x

Chart3D1.IsBatched = False

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback