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

Function textfitsInsideBar

src/traces/bar/plot.js:734–742  ·  view source on GitHub ↗
(barWidth, barHeight, textWidth, textHeight, isHorizontal)

Source from the content-addressed store, hash-verified

732}
733
734function textfitsInsideBar(barWidth, barHeight, textWidth, textHeight, isHorizontal) {
735 if (barWidth < 0 || barHeight < 0) return false;
736 var fitsInside = textWidth <= barWidth && textHeight <= barHeight;
737 var fitsInsideIfRotated = textWidth <= barHeight && textHeight <= barWidth;
738 var fitsInsideIfShrunk = isHorizontal
739 ? barWidth >= textWidth * (barHeight / textHeight)
740 : barHeight >= textHeight * (barWidth / textWidth);
741 return fitsInside || fitsInsideIfRotated || fitsInsideIfShrunk;
742}
743
744function getRotateFromAngle(angle) {
745 return angle === 'auto' ? 0 : angle;

Callers 1

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