MCPcopy Index your code
hub / github.com/leeoniya/uPlot / drawPath

Function drawPath

src/uPlot.js:1652–1695  ·  view source on GitHub ↗
(si, _points)

Source from the content-addressed store, hash-verified

1650 }
1651
1652 function drawPath(si, _points) {
1653 let s = _points ? series[si].points : series[si];
1654
1655 let {
1656 stroke,
1657 fill,
1658 clip: gapsClip,
1659 flags,
1660
1661 _stroke: strokeStyle = s._stroke,
1662 _fill: fillStyle = s._fill,
1663 _width: width = s.width,
1664 } = s._paths;
1665
1666 width = roundDec(width * pxRatio, 3);
1667
1668 let boundsClip = null;
1669 let offset = (width % 2) / 2;
1670
1671 if (_points && fillStyle == null)
1672 fillStyle = width > 0 ? "#fff" : strokeStyle;
1673
1674 let _pxAlign = s.pxAlign == 1 && offset > 0;
1675
1676 _pxAlign && ctx.translate(offset, offset);
1677
1678 if (!_points) {
1679 let lft = plotLft - width / 2,
1680 top = plotTop - width / 2,
1681 wid = plotWid + width,
1682 hgt = plotHgt + width;
1683
1684 boundsClip = new Path2D();
1685 boundsClip.rect(lft, top, wid, hgt);
1686 }
1687
1688 // the points pathbuilder's gapsClip is its boundsClip, since points dont need gaps clipping, and bounds depend on point size
1689 if (_points)
1690 strokeFill(strokeStyle, width, s.dash, s.cap, fillStyle, stroke, fill, flags, gapsClip);
1691 else
1692 fillStroke(si, strokeStyle, width, s.dash, s.cap, fillStyle, stroke, fill, flags, boundsClip, gapsClip);
1693
1694 _pxAlign && ctx.translate(-offset, -offset);
1695 }
1696
1697 function fillStroke(si, strokeStyle, lineWidth, lineDash, lineCap, fillStyle, strokePath, fillPath, flags, boundsClip, gapsClip) {
1698 let didStrokeFill = false;

Callers 1

drawSeriesFunction · 0.85

Calls 3

roundDecFunction · 0.90
strokeFillFunction · 0.85
fillStrokeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…