Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)

Set series X values from data stored in a single-dimension array (for XY-Scatter and XY-Curves).

Visual Basic
Public Sub SetSeriesXValuesFromArray( index As Integer, values As Array )
C#
public void SetSeriesXValuesFromArray( int index, Array values );

Arguments

index
An integer value that specifies the zero-based index of the series in the chart object.
values
A single-dimension array containing the series X values as elements: double[], string[], DateTime[], int[], float[], byte[], sbyte[], short[], ushort[], uint[], long[], or ulong[].

Remarks

Note: This method is available when manipulating XY data series required for displaying XY-Curves and XY-Scatter. Note that the Chart type (ie: bar, column, line, etc.) is defined in the Swiff Chart style file (.scs) which must be loaded via the LoadStyle method.

The data stored in the array must be numerical values.

If the index argument refers to a series that does not exist in the chart object, the series is created.

Sample Code

The following code shows how to store the XY values of the table below using the SetSeriesXValuesFromArray method. This table has two series named "Year 2006" and "Year 2007". Each of these two series contains independant X values and Y values.

Year 2006 Year 2007
X
Y
X
Y
1
12
1.5
14
2
7.5
1.8
9.9
3
11.3
3.7
13.1
4
9.2
3.9
11.5
5
5.3
5.8
4.9
  

Visual Basic
Dim array_x(4) As Double
Dim array_y(4) As Double

array_x(0) = 1.0
array_x(1) = 2.0
array_x(2) = 3.0
array_x(3) = 4.0
array_x(4) = 5.0

array_y(0) = 12.0
array_y(1) = 7.5
array_y(2) = 11.3
array_y(3) = 9.2
array_y(4) = 5.3

' Add the first series "Year 2006"
chart.SetSeriesCaption( 0, "Year 2006" )

' Fill the first series with XY values stored in the array variables
chart.SetSeriesXValuesFromArray( 0, array_x )
chart.SetSeriesYValuesFromArray( 0, array_y )

array_x(0) = 1.5
array_x(1) = 1.8
array_x(2) = 3.7
array_x(3) = 3.9
array_x(4) = 5.8

array_y(0) = 14.0
array_y(1) = 9.9
array_y(2) = 13.1
array_y(3) = 11.5
array_y(4) = 4.9

' Add the first series "Year 2007"
chart.SetSeriesCaption( 1, "Year 2007" )

' Fill the second series with XY values stored in the array variables
chart.SetSeriesXValuesFromArray( 1, array_x )
chart.SetSeriesYValuesFromArray( 1, array_y )
C#
double[] array_x= new double[5];
double[] array_y= new double[5];

array_x[0]= 1.0;
array_x[1]= 2.0;
array_x[2]= 3.0;
array_x[3]= 4.0;
array_x[4]= 5.0;

array_y[0]= 12.0;
array_y[1]= 7.5;
array_y[2]= 11.3;
array_y[3]= 9.2;
array_y[4]= 5.3;

// Add the first series "Year 2006"
chart.SetSeriesCaption( 0, "Year 2006" );

// Fill the first series with XY values stored in the array variables
chart.SetSeriesXValuesFromArray( 0, array_x );
chart.SetSeriesYValuesFromArray( 0, array_y );

array_x[0]= 1.5;
array_x[1]= 1.8;
array_x[2]= 3.7;
array_x[3]= 3.9;
array_x[4]= 5.8;

array_y[0]= 14.0;
array_y[1]= 9.9;
array_y[2]= 13.1;
array_y[3]= 11.5;
array_y[4]= 4.9;

// Add the first series "Year 2007"
chart.SetSeriesCaption( 1, "Year 2007" );

// Fill the second series with XY values stored in the array variables
chart.SetSeriesXValuesFromArray( 1, array_x );
chart.SetSeriesYValuesFromArray( 1, array_y );

See Also

SeriesCount Property | SetSeriesXValuesFromString Method | SetSeriesCaption Method | GetSeriesXValue Method

Applies To: Chart Object