GetTextDimensions

Returns the width and height dimensions of a text string.

Syntax

GetTextDimensions(text: string): { width: number; height: number }

Parameters

  • text: string - The text string to measure

Return Value

Returns an object with the following properties:

  • width: number - The width of the text in pixels

  • height: number - The height of the text in pixels

Description

The GetTextDimensions method calculates the dimensions of a text string using the current chart's canvas context. This is useful for positioning text objects and ensuring they fit within available space.

Example

Last updated