From 64d59c550b9a6becae30a80551bc1bd9968222a5 Mon Sep 17 00:00:00 2001 From: Dan Ellis Date: Thu, 28 Nov 2024 22:41:36 +0000 Subject: [PATCH] Update README.md --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 9ca8bfe..25a4b1c 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,26 @@ The algorithm outputs an array of arrays of subdivision points obtained on the l ``` ### How To Plot Plotting can be done by using standard *d3* methods i.e. drawing lines between each of the subdivision subpoints for each the initial graph edges. Since there is no support for advanced blending modes in **SVG** yet we use the *stroke-opacity* to mark overlapping segments. + +#### d3v5 +```javascript +// Define the line generator +var d3line = d3.line() + .x(function(d) { return d.x; }) + .y(function(d) { return d.y; }) + .curve(d3.curveLinear); // Use curveLinear for "linear" interpolation + +// Iterate over the results and draw lines +results.forEach(function(edge_subpoint_data) { + svg.append("path") + .attr("d", d3line(edge_subpoint_data)) + .style("stroke-width", 1) + .style("stroke", "#ff2222") + .style("fill", "none") + .style("stroke-opacity", 0.15); // Use opacity as blending +}); +``` +#### d3v3 ```javascript var d3line = d3.svg.line() .x(function(d){ return d.x; })