TextLabels

Declaration: ChartBook.Charts[].TextLabels[ix: integer]: TTextLabel;
The array property TextLabels contains the specifications of up to 30 user-defined text labels. These labels are not part of the data container and have been designed to provide a flexible means of labeling a chart. The parameter ix may vary between 1 and 30.

The property TextLabels provides the following sub-properties:

Alignment The property Alignment determines the horizontal alignment of the text. Alignment may have the following values: taLeftJustify, taRightJustify, and taCenter.
AttachToData The property AttachToData determines how the position coordinates PosX and PosY are interpreted by the chart. If AttachToData is tlamBoth the position values are seen as real world chart coordinates, thus "attaching" the label to the chart contents (panning or zooming the chart, also moves the labels). If AttachToData is tlamNone, the position information is interpreted as screen coordinates (pixels) relative to the left top corner of the chart window. In this case the label stays in its place when the data chart is zoomed or panned. The values tlamXOnly and tlamYOnly show a mixed behavior, attaching one coordinate to the chart and the other to the window.

Please note that changing the attach mode during run-time requires converting the current label coordinates from screen to chart coordinates and vice versa - otherwise the label will most probably get "lost".

Caption The text to be displayed. The text may have a maximum length of 255 characters. When the text contains an LF character (ASCII 10) a new line is generated, allowing a label to show several lines.
ColorBkg Color of the label background. The background color is only effective if the Transparent property is false. Note that the color of the text can be adjusted by setting the Color property of the Font.
ColorBorder Color of the label frame (Mode = tlBox) or the line below the label (Mode = tlUnderline ).
ColorShadow Color of the shadow of a label (Mode = tlShadow ). By default, ColorShadow is clGray.
Font The font of the label. You can select any font, style and color by setting the font properties (see Delphi manual for details).
Layer The layer the label belongs to.
Mode Defines the layout of the label (tlOff... label is invisible, tlSimple... just text without any lines tlUnderline... text is underlined, tlBox... a rectangular box is drawn around the label, tlShadow... a non-transparent box with a shadow is drawn)
PosX Position on x-axis. The position is interpreted as chart coordinates (real world coordinate system of the chart), if the property AttachToData is tlamXOnly or tlamBoth. Otherwise the position is regarded as pixel coordinates of the chart window. The reference point of the text label depends on the properties Alignment and VerticalAlignment.
PosY Position on y-axis. The position is interpreted as chart coordinates (real world coordinate system of the chart), if the property AttachToData is tlamYOnly or tlamBoth. Otherwise the position is regarded as pixel coordinates of the chart window. The reference point is the bottom of the label.
ShadowDx, ShadowDy Horizontal and vertical shift of the shadow (Mode = tlShadow ).
Transparent The background of the label is transparent if the property Transparent is set TRUE. In this case the background color is ignored. Please note that the Transparent property has no effect for shadowed labels (Mode = tlShadow ).
VerticalAlignment The property VerticalAlignment determines the vertical alignment of the text. VerticalAlignment may have the following values: vaTop, vaCenter, and vaBottom.
Visible The property Visible controls the visibility of the label. Please note the subtle difference between the properties Visible and Mode: setting Mode to tlOff has the same visual effect as setting Visible to FALSE; however, the associated structure in memory is made available for adding new labels by AddTextLabel when Mode is set to tlOff.

Sample
program:
The following short program displays two labels, one of which is only partially attached to the chart coordinates (pan the chart window to see the effect):

program TwoTextLabels;

var
  i : integer;

begin
Chartbook.Reset;
Chartbook.TabCaption[1] := 'Chart1 - Labels';
Chartbook.Configure (1,true,false,false,200,350);
with ChartBook.Charts[1] do
  begin
    // draw a simple graph
  Reset;
  MoveTo(0,0);
  for i:=1 to 300 do
    DrawTo (i, ln(i*0.01)*sin(0.25*i));
  AutoRange (1,4);
    // now add two text labels
  with TextLabels[1] do
    begin
    PosX := 100;
    PosY := -0.5;
    Mode := tlShadow;
    Visible := true;
    VerticalAlignment := vaTop;
    Caption := 'Label 1'#10'showing'#10'three lines';
    end;
  with TextLabels[2] do
    begin
    AttachToData := tlamYOnly;
    PosX:= 400;
    PosY := -1;
    Mode := tlShadow;
    ColorBkg := clYellow;
    Visible := true;
    Caption := 'Attached to y only';
    end;
  end;
ChartBook.Charts[1].Update;
end.