Search Locate Previous Next Contents

ch.TextWidth – 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„ch.TextWidth note
 ch.Set'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 ...
ch.Note – add chart notes
NoteNudge – Nudge note position


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