MCPcopy
hub / github.com/chartjs/Chart.js / _measureText

Function _measureText

src/helpers/helpers.canvas.ts:39–55  ·  view source on GitHub ↗
(
  ctx: CanvasRenderingContext2D,
  data: Record<string, number>,
  gc: string[],
  longest: number,
  string: string
)

Source from the content-addressed store, hash-verified

37 * @private
38 */
39export function _measureText(
40 ctx: CanvasRenderingContext2D,
41 data: Record<string, number>,
42 gc: string[],
43 longest: number,
44 string: string
45) {
46 let textWidth = data[string];
47 if (!textWidth) {
48 textWidth = data[string] = ctx.measureText(string).width;
49 gc.push(string);
50 }
51 if (textWidth > longest) {
52 longest = textWidth;
53 }
54 return longest;
55}
56
57type Thing = string | undefined | null
58type Things = (Thing | Thing[])[]

Callers 2

_computeLabelSizesMethod · 0.85
_longestTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected