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

Function getTextShiftX

src/components/fx/hover.js:2032–2048  ·  view source on GitHub ↗

* Calculate the shift in x for text and text2 elements

(hoverLabel)

Source from the content-addressed store, hash-verified

2030 * Calculate the shift in x for text and text2 elements
2031 */
2032function getTextShiftX(hoverLabel) {
2033 var alignShift = { start: 1, end: -1, middle: 0 }[hoverLabel.anchor];
2034 var textShiftX = alignShift * (HOVERARROWSIZE + HOVERTEXTPAD);
2035 var text2ShiftX = textShiftX + alignShift * (hoverLabel.txwidth + HOVERTEXTPAD);
2036
2037 var isMiddle = hoverLabel.anchor === 'middle';
2038 if (isMiddle) {
2039 textShiftX -= hoverLabel.tx2width / 2;
2040 text2ShiftX += hoverLabel.txwidth / 2 + HOVERTEXTPAD;
2041 }
2042
2043 return {
2044 alignShift: alignShift,
2045 textShiftX: textShiftX,
2046 text2ShiftX: text2ShiftX
2047 };
2048}
2049
2050function alignHoverText(hoverLabels, rotateLabels, scaleX, scaleY) {
2051 var pX = function (x) {

Callers 1

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