Search Locate Previous Next Contents

chTextWidth – measure text

This is a simple utility to measure text (typically for notes). Accepts simple strings or text arrays, and uses the normal wrapping rules on strings. Returns the width of the longest line as a decimal value in points.

 note„'Hello in;left-justified, centred;text (at 15,12)' 
 tw„chTextWidth note
 chSet'nnudge'(-0.5×tw)

This could be used (as in the example) to centre a block of left-aligned text. The left argument may be used to pass a font specification – this defaults to the current note font if not given.

See also ...
chNote – add chart notes
NoteNudge – Nudge note position


Continue to: chTip – supply pop-up tips for data points
© Copyright Causeway Graphical Systems Ltd 2003