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

Function transformOutsideText

src/traces/pie/plot.js:847–864  ·  view source on GitHub ↗
(textBB, pt)

Source from the content-addressed store, hash-verified

845}
846
847function transformOutsideText(textBB, pt) {
848 var x = pt.pxmid[0];
849 var y = pt.pxmid[1];
850 var dx = textBB.width / 2;
851 var dy = textBB.height / 2;
852
853 if (x < 0) dx *= -1;
854 if (y < 0) dy *= -1;
855
856 return {
857 scale: 1,
858 rCenter: 1,
859 rotate: 0,
860 x: dx + (Math.abs(dy) * (dx > 0 ? 1 : -1)) / 2,
861 y: dy / (1 + (x * x) / (y * y)),
862 outside: true
863 };
864}
865
866function positionTitleInside(cd0) {
867 var textDiameter = Math.sqrt(cd0.titleBox.width * cd0.titleBox.width + cd0.titleBox.height * cd0.titleBox.height);

Callers 1

plotFunction · 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…