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

Function calculateTextOffset

src/traces/scatter3d/convert.js:141–163  ·  view source on GitHub ↗
(tp)

Source from the content-addressed store, hash-verified

139}
140
141function calculateTextOffset(tp) {
142 // Read out text properties
143
144 var defaultAlignmentX = 0;
145 var defaultAlignmentY = 0;
146
147 var textOffset = [defaultAlignmentX, defaultAlignmentY];
148
149 if (Array.isArray(tp)) {
150 for (var i = 0; i < tp.length; i++) {
151 textOffset[i] = [defaultAlignmentX, defaultAlignmentY];
152 if (tp[i]) {
153 textOffset[i][0] = parseAlignmentX(tp[i]);
154 textOffset[i][1] = parseAlignmentY(tp[i]);
155 }
156 }
157 } else {
158 textOffset[0] = parseAlignmentX(tp);
159 textOffset[1] = parseAlignmentY(tp);
160 }
161
162 return textOffset;
163}
164
165function calculateSize(sizeIn, sizeFn) {
166 // rough parity with Plotly 2D markers

Callers 1

convertPlotlyOptionsFunction · 0.85

Calls 2

parseAlignmentXFunction · 0.85
parseAlignmentYFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…