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

Function makePolygonsToPrevious

src/traces/scatter/plot.js:349–383  ·  view source on GitHub ↗
(prevFillsegments)

Source from the content-addressed store, hash-verified

347 };
348
349 var makePolygonsToPrevious = function(prevFillsegments) {
350 var polygons, i;
351 if(!prevFillsegments || prevFillsegments.length === 0) {
352 // if there are no fill segments of a previous trace, stretch the
353 // polygon to the relevant axis
354 polygons = new Array(fillsegments.length);
355 for(i = 0; i < fillsegments.length; i++) {
356 var pt0 = fillsegments[i][0].slice();
357 var pt1 = fillsegments[i][fillsegments[i].length - 1].slice();
358
359 pt0[fillAxisIndex] = pt1[fillAxisIndex] = fillAxisZero;
360
361 var zeropoints = [pt1, pt0];
362 var polypoints = zeropoints.concat(fillsegments[i]);
363 polygons[i] = polygonTester(polypoints);
364 }
365 } else {
366 // if there are more than one previous fill segment, the
367 // way that fills work is to "self" fill all but the last segments
368 // of the previous and then fill from the new trace to the last
369 // segment of the previous.
370 polygons = new Array(prevFillsegments.length - 1 + fillsegments.length);
371 for(i = 0; i < prevFillsegments.length - 1; i++) {
372 polygons[i] = polygonTester(prevFillsegments[i]);
373 }
374
375 var reversedPrevFillsegment = prevFillsegments[prevFillsegments.length - 1].slice();
376 reversedPrevFillsegment.reverse();
377
378 for(i = 0; i < fillsegments.length; i++) {
379 polygons[prevFillsegments.length - 1 + i] = polygonTester(fillsegments[i].concat(reversedPrevFillsegment));
380 }
381 }
382 return polygons;
383 };
384
385 // draw fills and create hover detection polygons
386 if(segments.length) {

Callers 1

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