YOUSEFUL / DELPHI / COMPONENTS

TAtlasChartSeries

One named, coloured list of points in a TAtlasChart, created by AddSeries.

Class Unit Atlas.Charts · Inherits TObject · Product Atlas VCL

Description

A series belongs to the TAtlasChart whose AddSeries created it, and is freed by that chart's Clear or destructor. Points keep the order in which you add them and a line is drawn in that order, so add points in increasing X for an ordinary line chart. Each Add, AddMissing and Clear repaints the chart. The caption and colour are fixed when the series is created. A single point cannot be removed or changed; call Clear and add the points again.

Members

MemberKindWhat it does
CreateconstructorLow-level constructor; use TAtlasChart.AddSeries instead.
DestroydestructorFrees the points.
AddmethodAppends a point.
AddMissingmethodAppends a point without a value at X.
ClearmethodRemoves all points and repaints the chart.
CountpropertyNumber of points, missing ones included.
PointspropertyCopy of the point at zero-based Index; changing the copy does not change the chart.
CaptionpropertyLegend caption given to AddSeries.
ColorpropertyColour given to AddSeries.

Constructors

Create constructor

constructor Create(Chart: TAtlasChart; const Caption: string; Color: TColor);

Low-level constructor; use TAtlasChart.AddSeries instead. A series created directly is not in the chart's series list, is not drawn, and must be freed by you, although its Add still validates against and repaints Chart.

Destructors

Destroy destructor

destructor Destroy; override;

Frees the points. The owning chart calls it; do not free a series the chart owns.

Properties

Count property

property Count: Integer read GetCount;

Number of points, missing ones included.

Points property

property Points[Index: Integer]: TAtlasChartPoint read GetPoint;

Copy of the point at zero-based Index; changing the copy does not change the chart. An invalid index raises EArgumentOutOfRangeException.

pascal
for I := 0 to Series.Count - 1 do
  if Series.Points[I].Missing then Exit;

Caption property

property Caption: string read FCaption;

Legend caption given to AddSeries. Read-only.

Color property

property Color: TColor read FColor;

Colour given to AddSeries. Read-only.

Methods

Add method

procedure Add(X, Y: Double; const Caption: string = '');

Appends a point. Caption labels the point on the X axis of a bar chart (when every point of the first series has one) and in a pie legend. Raises EAtlasChartError if X or Y is NaN or infinite or has a magnitude above 1E100, and if Y is negative while the chart's Kind is acPie.

pascal
Series.Add(3, 42.5, 'Mar');

AddMissing method

procedure AddMissing(X: Double);

Appends a point without a value at X. A line breaks there, no bar is drawn, a pie skips it and BoundsOfData ignores it. X must be finite.

pascal
Series.AddMissing(4);

Clear method

procedure Clear;

Removes all points and repaints the chart. The series stays in the chart.

Examples

Total of a series

Reads the points back and skips the missing ones.

pascal
uses Atlas.Charts;

function SeriesTotal(Series: TAtlasChartSeries): Double;
var
  I: Integer;
  Point: TAtlasChartPoint;
begin
  Result := 0;
  for I := 0 to Series.Count - 1 do
  begin
    Point := Series.Points[I];
    if not Point.Missing then Result := Result + Point.Y;
  end;
end;

TAtlasChart · TAtlasChartPoint

Also in Atlas VCL

TAtlasTable · TAtlasGrid · TAtlasValueEdit · TAtlasTree · TAtlasWorkbook · TAtlasSheetGrid · TAtlasPivot · TAtlasInspector · TAtlasRichEdit · TAtlasSpellChecker · TAtlasChart · TAtlasGauge · TAtlasThemer · TAtlasWizard · TAtlasWorkspace · TAtlasCommandBar · TAtlasActionTile · TAtlasTileBoard · TAtlasNavigation · TAtlasMap · TAtlasGraph · TAtlasDiagram · TAtlasPrintDocument · TAtlasSchedule · TAtlasScheduler · TAtlasTaskPlan · TAtlasGantt · TAtlasPdfDocument · TAtlasPdfViewer