ComponentOne Chart for .NET (2.0) Search HelpCentral 

Changing Data Elements in the Data Arrays

The method of altering individual data elements in the data arrays involves the ChartDataSeries and the ChartDataArray objects. 

Setting individual values through the .NET Properties window is made quite easy by the ChartDataArray Collection Editor. Data array editors exist for the X, Y, Y1, Y2, Y3, and PointData arrays. These editors can be accessed by clicking the ellipsis next to the appropriate data array in the SeriesList Collection Editor (which is available under the ChartData node of the ChartGroupsCollection Editor). Similar to the .NET collection editors, the ChartDataArray Editor has the array indices in a text box on the left and the array values on the right.

Note: The ChartDataArray Collection Editor also contains functionality for toggling the display between Date, DateTime, and Time display. If the values for the ChartDataArray are of DateTime type, then by clicking on the header above the value column, the values displayed will toggle between DateTime, Date and Time formats.

At run time the ChartDataArray elements are available like any normal array elements would be. Changing the values in the array objects is as easy as changing the values in an array:

·      Visual Basic

C1Chart1.ChartGroups.Group0.ChartData.SeriesList(0).X(4) = 4

·      C#

C1Chart1.ChartGroups.Group0.ChartData.SeriesList[0].X[4] = 4;

·      Delphi

begin

  C1Chart1.ChartGroups.Group0.ChartData.SeriesList[0].X[4] = 4;

end;

Retrieving the values from the ChartDataArray requires a similar process:

·      Visual Basic

Dim xval As Single

xval = C1Chart1.ChartGroups.Group0.ChartData.SeriesList(0).X(4)

·      C#

float xval;

xval = C1Chart1.ChartGroups.Group0.ChartData.SeriesList[0].X[4];

·      Delphi

var

  xval: Single;

begin

  xval = C1Chart1.ChartGroups.Group0.ChartData.SeriesList[0].X[4];

end;


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.