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

Function pathAncestor

src/traces/treemap/plot_one.js:149–207  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

147
148 // pathbar(directory) path generation fn
149 var pathAncestor = function(d) {
150 var _x0 = viewBarX(Math.max(Math.min(d.x0, d.x0), 0));
151 var _x1 = viewBarX(Math.min(Math.max(d.x1, d.x1), barW));
152 var _y0 = viewBarY(d.y0);
153 var _y1 = viewBarY(d.y1);
154
155 var halfH = barH / 2;
156
157 var pL = {};
158 var pR = {};
159
160 pL.x = _x0;
161 pR.x = _x1;
162
163 pL.y = pR.y = (_y0 + _y1) / 2;
164
165 var pA = {x: _x0, y: _y0};
166 var pB = {x: _x1, y: _y0};
167 var pC = {x: _x1, y: _y1};
168 var pD = {x: _x0, y: _y1};
169
170 if(edgeshape === '>') {
171 pA.x -= halfH;
172 pB.x -= halfH;
173 pC.x -= halfH;
174 pD.x -= halfH;
175 } else if(edgeshape === '/') {
176 pC.x -= halfH;
177 pD.x -= halfH;
178 pL.x -= halfH / 2;
179 pR.x -= halfH / 2;
180 } else if(edgeshape === '\\') {
181 pA.x -= halfH;
182 pB.x -= halfH;
183 pL.x -= halfH / 2;
184 pR.x -= halfH / 2;
185 } else if(edgeshape === '<') {
186 pL.x -= halfH;
187 pR.x -= halfH;
188 }
189
190 limitX0(pA);
191 limitX0(pD);
192 limitX0(pL);
193
194 limitX0(pB);
195 limitX0(pC);
196 limitX0(pR);
197
198 return (
199 'M' + pos(pA.x, pA.y) +
200 'L' + pos(pB.x, pB.y) +
201 'L' + pos(pR.x, pR.y) +
202 'L' + pos(pC.x, pC.y) +
203 'L' + pos(pD.x, pD.y) +
204 'L' + pos(pL.x, pL.y) +
205 'Z'
206 );

Callers

nothing calls this directly

Calls 4

viewBarXFunction · 0.85
viewBarYFunction · 0.85
limitX0Function · 0.85
posFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…