Skip to content

Commit 116f116

Browse files
committed
draw events as circles
1 parent c9d1e4f commit 116f116

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
function start() {
1919
var w = 800;
2020
var h = 600;
21+
var radius = 20;
2122

2223
var content = d3.select("#divContent");
2324
var svg = content.append("svg").attr({
@@ -32,7 +33,17 @@
3233
console.warn(err);
3334
return;
3435
}
35-
console.log(data);
36+
37+
var events = data["events"];
38+
39+
var sel = svg.selectAll("circle.event").data(events);
40+
sel.exit().remove();
41+
sel.enter().append("circle").classed("event", true);
42+
sel.attr({
43+
"cx": w * 0.5,
44+
"cy": h * 0.5,
45+
"r": radius
46+
});
3647
});
3748
}
3849

outline.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1. Importing D3 Library (X)
44
2. Load patient JSON file (X)
55
3. Set up canvas (X)
6-
4. Draw a circle for each patient event
6+
4. Draw a circle for each patient event (X)
77
5. Position circles horizontally by timestamp
88
* Create a time scale
99
6. Color nodes by event type

0 commit comments

Comments
 (0)