The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Text


Unit: SDL_rchart
Class: TRChart
Declaration: [1] procedure Text (x,y: double; size: integer; txt: string);
[2] procedure Text (x,y: double; size: integer; txt: string; dx, dy: integer; Alignment: TAlignment);
[3] procedure Text (x,y: integer; size: integer; txt: string);
[4] procedure Text (x: integer; y: double; size: integer; txt: string);
[5] procedure Text (x: double; y: integer; size: integer; txt: string);

The method Text is used to provide short labels for data points within a chart. It displays the text txt at the position [x,y]. There are two versions available: version [1] positions the label at the specified location and uses the text alignment specified by the property TextAlignment. Version [2] allows to offset the text by a specific number of pixels given by the parameters dx and dy. The text alignment is specified by the parameter Alignment. Version [3] of Text draws the text in the screen coordinate system. Versions [4] draws all x values in the screen coordinate system and all y values in the world coodinates, version [5] uses for the x values the world coordinate system and for the y values screen coordinates. Using screen coordinates has the effect that the text remains at a fixed position even if the chart is panned or zoomed.

The first MAXLONGTEXTS calls of the Text procedure can process and store text of any length, all further calls restrict the stored text to MAXSHORTTXTLENG (15) characters. The size of the font (in points) is determined by the parameter size. The type of the font is determined by the Font  property. The transparency, the style and the colors are controlled by the properties TextBkStyle, TextFontStyle, DataColor and FillColor, respectively.


Hint 1: You can create multi-line text labels by inserting a LF (line feed, ASCII $0A) character at the intented line break.

Hint 2: In the Light Edition the number of chart elements (including any text labels) is restricted to 1000 elements.

Example: This method is used in the following example program (see http://www.lohninger.com/examples.html for downloading the code): cluster, convexhull, dendro, geodata, printcht, rctextlabel, simplepca



Last Update: 2017-Okt-16