Kaido gave an excellent and complete answer for why the SVG path with a thick stroke width is displayed with artifacts and how to avoid this. I will try to provide a little more information that is typical for D3.js Sankey diagrams, as I recently encountered the same problem as Peter Migdal.
Original Sankey Chart Code
(from Sankey.js in this Sankey example , which is similar to the example mentioned by Peter Migdal)
// regular forward node var x0 = d.source.x + d.source.dx, x1 = d.target.x, xi = d3.interpolateNumber(x0, x1), x2 = xi(curvature), x3 = xi(1 - curvature), y0 = d.source.y + d.sy + d.dy / 2, y1 = d.target.y + d.ty + d.dy / 2; return "M" + x0 + "," + y0 + "C" + x2 + "," + y0 + " " + x3 + "," + y1 + " " + x1 + "," + y1;
Modified code
// regular forward node var x0 = d.source.x + d.source.dx, x1 = d.target.x, xi = d3.interpolateNumber(x0, x1), x2 = xi(curvature), x3 = xi(1 - curvature), y0 = d.source.y + d.sy, y1 = d.target.y + d.ty; return "M" + x0 + "," + y0 + "C" + x2 + "," + y0 + " " + x3 + "," + y1 + " " + x1 + "," + y1 // move down for the wanted width + "l" + 0 + "," + d.dy // draw another path below mirroring the top + "C" + x3 + "," + (y1 + d.dy) + " " + x2 + "," + (y0 + d.dy) + " " + x0 + "," + (y0 + d.dy);
Then you will also need to change your css:
- stroke: none
- set fill color
and remove any D3 code that sets the stroke width of the HTML elements.