MCPcopy Index your code
hub / github.com/plotly/plotly.js / fitTextInsideCircle

Function fitTextInsideCircle

src/traces/indicator/plot.js:847–852  ·  view source on GitHub ↗
(textBB, radius)

Source from the content-addressed store, hash-verified

845}
846
847function fitTextInsideCircle(textBB, radius) {
848 // compute scaling ratio to have text fit within specified radius
849 var elRadius = Math.sqrt((textBB.width / 2) * (textBB.width / 2) + textBB.height * textBB.height);
850 var ratio = radius / elRadius;
851 return [ratio, textBB, radius];
852}
853
854function measureText(txt, font, textAnchor, gd) {
855 var element = document.createElementNS('http://www.w3.org/2000/svg', 'text');

Callers 1

plot.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…