Skip to content

Commit 4a5a8b0

Browse files
committed
overlay the genetic graph over the random graph
1 parent a184b11 commit 4a5a8b0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

public/linegraph.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ d3.select("#matchgraph").html("Matched Graph <br/>"+equation)
1717
console.log(data)
1818
console.log(data2)
1919

20-
makeGraph(500,400,"#goalGraph", data)
20+
makeGraph(500,400,"#goalGraph", data, data2)
2121
makeGraph(500,400,"#bestGraph", data2)
2222

2323
//make reusable for components
24-
function makeGraph(w, h, canvas, data) {
24+
function makeGraph(w, h, canvas, data, data2) {
2525

2626
//based on mike bostock's simple example
2727
margin = 30
@@ -83,6 +83,14 @@ function makeGraph(w, h, canvas, data) {
8383
.attr("stroke-width", 2)
8484
.attr("fill", "none");
8585

86+
if (data2)
87+
svg.append("path")
88+
.attr("d", line(data2))
89+
.attr("stroke", "firebrick")
90+
.attr("stroke-width", 2)
91+
.attr("fill", "none");
92+
93+
8694
//function sigmoid(t) { with (Math) { return 1 / (1 + exp(-2*t)); } }
8795
//chart.cartesian(sigmoid, [-5, 5, 100]);
8896
}

0 commit comments

Comments
 (0)