ComponentOne Chart for .NET (2.0) Search HelpCentral 

Setting the X and Y Data Arrays Using Point Values

For charts that only use the X and Y-axes (XY-Plot, Bar, and so on), the PointData property can be a convenient shortcut. The PointData property of the ChartDataSeries object allows the entering of an array of PointF point values. This property is convenient for applications that use point data, but this array will only set the X and Y data arrays. This property cannot change the values in the data arrays for Y1, Y2, or Y3.

The following example builds a PointF array and loads it into a ChartDataSeries:

·      Visual Basic

Dim ps() As PointF = _

{ _

    New PointF(30.0F, 20.0F), _

    New PointF(60.0F, 24.0F), _

    New PointF(90.0F, 42.0F), _

    New PointF(120.0F, 13.0F), _

    New PointF(150.0F, 10.0F) _

}

 

Dim s As New ChartDataSeries()

C1Chart1.ChartGroups.Group1.ChartData.SeriesList.Add(s)

s.PointData.CopyDataIn(ps)

·      C#

PointF [] ps =

{

    new PointF(30.0F, 20.0F),

    new PointF(60.0F, 24.0F),

    new PointF(90.0F, 42.0F),

    new PointF(120.0F, 13.0F),

    new PointF(150.0F, 10.0F)

};

 

ChartDataSeries  s = new ChartDataSeries();

C1Chart1.ChartGroups.Group1.ChartData.SeriesList.Add(s);

s.PointData.CopyDataIn(ps);

·      Delphi

var

  s: ChartDataSeries;

  ps: array of PointF;

 

begin

  SetLength(ps, 5);

  ps[0] := PointF.Create(30, 20);

  ps[1] := PointF.Create(60, 24);

  ps[2] := PointF.Create(90, 42);

  ps[3] := PointF.Create(120, 13);

  ps[4] := PointF.Create(150, 10);

 

  s := ChartDataSeries.Create();

  C1Chart1.ChartGroups.Group1.ChartData.SeriesLisdt.Add(s);

  s.PointData.CopyDataIn(ps);

end;

 


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