MCPcopy Create free account
hub / github.com/plotly/plotly.js / makePoints

Function makePoints

src/traces/scatter/plot.js:488–609  ·  view source on GitHub ↗
(points, text, cdscatter)

Source from the content-addressed store, hash-verified

486 }
487
488 function makePoints(points, text, cdscatter) {
489 var join, selection, hasNode;
490
491 var trace = cdscatter[0].trace;
492 var showMarkers = subTypes.hasMarkers(trace);
493 var showText = subTypes.hasText(trace);
494
495 var keyFunc = getKeyFunc(trace);
496 var markerFilter = hideFilter;
497 var textFilter = hideFilter;
498
499 if(showMarkers || showText) {
500 var showFilter = identity;
501 // if we're stacking, "infer zero" gap mode gets markers in the
502 // gap points - because we've inferred a zero there - but other
503 // modes (currently "interpolate", later "interrupt" hopefully)
504 // we don't draw generated markers
505 var stackGroup = trace.stackgroup;
506 var isInferZero = stackGroup && (
507 gd._fullLayout._scatterStackOpts[xa._id + ya._id][stackGroup].stackgaps === 'infer zero');
508 if(trace.marker.maxdisplayed || trace._needsCull) {
509 showFilter = isInferZero ? visFilterWithGaps : visFilter;
510 } else if(stackGroup && !isInferZero) {
511 showFilter = gapFilter;
512 }
513
514 if(showMarkers) markerFilter = showFilter;
515 if(showText) textFilter = showFilter;
516 }
517
518 // marker points
519
520 selection = points.selectAll('path.point');
521
522 join = selection.data(markerFilter, keyFunc);
523
524 var enter = join.enter().append('path')
525 .classed('point', true);
526
527 if(hasTransition) {
528 enter
529 .call(Drawing.pointStyle, trace, gd)
530 .call(Drawing.translatePoints, xa, ya)
531 .style('opacity', 0)
532 .transition()
533 .style('opacity', 1);
534 }
535
536 join.order();
537
538 var styleFns;
539 if(showMarkers) {
540 styleFns = Drawing.makePointStyleFns(trace);
541 }
542
543 join.each(function(d) {
544 var el = d3.select(this);
545 var sel = transition(el);

Callers 1

plotOneFunction · 0.70

Calls 2

getKeyFuncFunction · 0.70
transitionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…