Skip to content

Instantly share code, notes, and snippets.

@thole
Last active November 14, 2015 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thole/153cd08a7618925afad2 to your computer and use it in GitHub Desktop.
Save thole/153cd08a7618925afad2 to your computer and use it in GitHub Desktop.
parallel dialogs
START END
2013-04-28 00:00:26 2013-04-28 00:00:40
2013-04-28 00:11:43 2013-04-28 00:20:50
2013-04-28 00:19:47 2013-04-28 00:22:15
2013-04-28 00:53:43 2013-04-28 00:53:59
2013-04-28 00:54:49 2013-04-28 00:57:30
2013-04-28 06:26:12 2013-04-28 06:27:32
2013-04-28 07:14:56 2013-04-28 07:14:56
2013-04-28 07:17:02 2013-04-28 07:17:02
2013-04-28 07:20:23 2013-04-28 07:20:23
2013-04-28 07:32:01 2013-04-28 07:33:01
2013-04-28 07:54:42 2013-04-28 07:55:28
2013-04-28 08:14:35 2013-04-28 08:15:15
2013-04-28 08:17:41 2013-04-28 08:18:21
2013-04-28 08:24:06 2013-04-28 08:24:06
2013-04-28 08:26:17 2013-04-28 08:26:17
2013-04-28 08:39:00 2013-04-28 08:39:29
2013-04-28 08:44:09 2013-04-28 08:44:47
2013-04-28 08:54:26 2013-04-28 08:54:26
2013-04-28 09:08:49 2013-04-28 09:11:12
2013-04-28 09:17:46 2013-04-28 09:17:46
2013-04-28 09:30:56 2013-04-28 09:31:19
2013-04-28 09:32:19 2013-04-28 09:35:48
2013-04-28 09:36:13 2013-04-28 09:36:13
2013-04-28 09:36:31 2013-04-28 09:38:39
2013-04-28 09:36:36 2013-04-28 09:36:36
2013-04-28 09:38:22 2013-04-28 09:38:51
2013-04-28 09:39:37 2013-04-28 09:39:37
2013-04-28 09:59:01 2013-04-28 09:59:07
2013-04-28 10:00:50 2013-04-28 10:07:12
2013-04-28 10:14:09 2013-04-28 10:15:17
2013-04-28 10:14:32 2013-04-28 10:15:29
2013-04-28 10:16:39 2013-04-28 10:17:58
2013-04-28 10:18:03 2013-04-28 10:19:40
2013-04-28 10:24:58 2013-04-28 10:24:58
2013-04-28 10:25:03 2013-04-28 10:26:24
2013-04-28 10:27:04 2013-04-28 10:27:32
2013-04-28 10:28:37 2013-04-28 10:31:50
2013-04-28 10:28:42 2013-04-28 10:28:42
2013-04-28 10:31:43 2013-04-28 10:31:43
2013-04-28 10:33:16 2013-04-28 10:53:03
2013-04-28 10:34:00 2013-04-28 10:37:38
2013-04-28 10:38:26 2013-04-28 10:38:26
2013-04-28 10:49:14 2013-04-28 10:50:15
2013-04-28 10:59:47 2013-04-28 10:59:47
2013-04-28 11:00:10 2013-04-28 11:00:32
2013-04-28 11:10:50 2013-04-28 11:14:55
2013-04-28 11:19:51 2013-04-28 11:19:51
2013-04-28 11:28:59 2013-04-28 11:30:32
2013-04-28 11:34:15 2013-04-28 11:34:15
2013-04-28 11:39:09 2013-04-28 11:39:40
2013-04-28 11:39:15 2013-04-28 11:41:44
2013-04-28 11:39:30 2013-04-28 11:43:09
2013-04-28 11:41:53 2013-04-28 11:47:29
2013-04-28 11:42:59 2013-04-28 11:42:59
2013-04-28 11:43:04 2013-04-28 11:43:04
2013-04-28 11:46:45 2013-04-28 11:46:50
2013-04-28 11:47:23 2013-04-28 11:47:57
2013-04-28 11:55:20 2013-04-28 11:56:27
2013-04-28 11:57:26 2013-04-28 13:17:42
2013-04-28 12:07:54 2013-04-28 12:09:53
2013-04-28 12:10:26 2013-04-28 12:13:55
2013-04-28 12:14:53 2013-04-28 12:15:50
2013-04-28 12:23:05 2013-04-28 12:23:05
2013-04-28 12:25:22 2013-04-28 12:27:19
2013-04-28 12:35:21 2013-04-28 12:35:21
2013-04-28 12:36:53 2013-04-28 12:38:00
2013-04-28 12:37:13 2013-04-28 12:40:43
2013-04-28 12:38:05 2013-04-28 12:40:05
2013-04-28 12:39:26 2013-04-28 12:40:57
2013-04-28 12:41:14 2013-04-28 12:42:01
2013-04-28 12:44:57 2013-04-28 12:44:57
2013-04-28 12:49:07 2013-04-28 12:58:37
2013-04-28 12:59:35 2013-04-28 13:00:32
2013-04-28 12:59:55 2013-04-28 12:59:55
2013-04-28 13:03:53 2013-04-28 13:15:38
2013-04-28 13:06:11 2013-04-28 13:06:11
2013-04-28 13:06:32 2013-04-28 13:11:27
2013-04-28 13:10:49 2013-04-28 13:12:34
2013-04-28 13:12:11 2013-04-28 13:16:14
2013-04-28 13:13:09 2013-04-28 13:17:08
2013-04-28 13:13:56 2013-04-28 13:13:56
2013-04-28 13:14:21 2013-04-28 13:15:00
2013-04-28 13:15:50 2013-04-28 13:18:13
2013-04-28 13:21:18 2013-04-28 13:23:40
2013-04-28 13:22:02 2013-04-28 13:40:21
2013-04-28 13:24:06 2013-04-28 13:26:15
2013-04-28 13:26:35 2013-04-28 13:29:34
2013-04-28 13:31:04 2013-04-28 13:32:10
2013-04-28 13:31:11 2013-04-28 13:31:11
2013-04-28 13:41:58 2013-04-28 13:46:44
2013-04-28 13:46:24 2013-04-28 13:47:18
2013-04-28 13:49:42 2013-04-28 13:50:45
2013-04-28 13:52:57 2013-04-28 13:53:44
2013-04-28 13:53:35 2013-04-28 13:54:25
2013-04-28 13:56:18 2013-04-28 13:56:48
2013-04-28 13:57:31 2013-04-28 14:02:31
2013-04-28 14:00:37 2013-04-28 14:01:45
2013-04-28 14:02:59 2013-04-28 14:02:59
2013-04-28 14:03:22 2013-04-28 14:03:27
2013-04-28 14:06:46 2013-04-28 14:06:46
2013-04-28 14:06:57 2013-04-28 14:07:19
2013-04-28 14:09:05 2013-04-28 14:09:10
2013-04-28 14:12:05 2013-04-28 14:12:10
2013-04-28 14:13:05 2013-04-28 14:13:11
2013-04-28 14:14:41 2013-04-28 14:15:15
2013-04-28 14:15:58 2013-04-28 14:16:27
2013-04-28 14:32:39 2013-04-28 14:32:39
2013-04-28 14:42:18 2013-04-28 14:42:18
2013-04-28 14:43:29 2013-04-28 14:43:29
2013-04-28 14:58:28 2013-04-28 15:01:03
2013-04-28 15:00:48 2013-04-28 15:00:48
2013-04-28 15:01:39 2013-04-28 15:01:39
2013-04-28 15:17:30 2013-04-28 15:17:30
2013-04-28 15:30:51 2013-04-28 15:31:45
2013-04-28 15:35:05 2013-04-28 15:35:05
2013-04-28 15:39:10 2013-04-28 15:41:26
2013-04-28 15:42:03 2013-04-28 15:43:13
2013-04-28 15:52:44 2013-04-28 15:52:44
2013-04-28 15:56:07 2013-04-28 15:56:07
2013-04-28 16:05:35 2013-04-28 16:05:59
2013-04-28 16:07:44 2013-04-28 16:07:44
2013-04-28 16:13:10 2013-04-28 16:14:28
2013-04-28 16:18:33 2013-04-28 16:18:33
2013-04-28 16:24:45 2013-04-28 16:25:04
2013-04-28 16:26:45 2013-04-28 16:26:50
2013-04-28 16:27:39 2013-04-28 16:29:29
2013-04-28 16:36:24 2013-04-28 16:36:24
2013-04-28 16:44:22 2013-04-28 16:51:01
2013-04-28 16:47:19 2013-04-28 16:47:49
2013-04-28 16:49:47 2013-04-28 16:50:39
2013-04-28 16:51:32 2013-04-28 16:52:52
2013-04-28 16:54:10 2013-04-28 16:54:10
2013-04-28 16:58:49 2013-04-28 17:01:36
2013-04-28 16:59:48 2013-04-28 17:00:41
2013-04-28 17:01:22 2013-04-28 17:04:13
2013-04-28 17:02:32 2013-04-28 17:03:01
2013-04-28 17:04:52 2013-04-28 17:09:06
2013-04-28 17:12:55 2013-04-28 17:12:55
2013-04-28 17:30:43 2013-04-28 17:35:26
2013-04-28 17:33:03 2013-04-28 17:33:03
2013-04-28 17:33:16 2013-04-28 17:33:50
2013-04-28 17:42:28 2013-04-28 17:42:54
2013-04-28 17:43:09 2013-04-28 17:44:07
2013-04-28 17:48:25 2013-04-28 17:48:25
2013-04-28 17:48:45 2013-04-28 17:51:12
2013-04-28 17:59:36 2013-04-28 17:59:36
2013-04-28 18:03:24 2013-04-28 18:05:01
2013-04-28 18:05:19 2013-04-28 18:05:19
2013-04-28 18:05:28 2013-04-28 18:05:57
2013-04-28 18:06:03 2013-04-28 18:06:03
2013-04-28 18:12:47 2013-04-28 18:12:47
2013-04-28 18:18:06 2013-04-28 18:18:06
2013-04-28 18:20:45 2013-04-28 18:22:23
2013-04-28 18:21:18 2013-04-28 18:21:18
2013-04-28 18:21:26 2013-04-28 18:24:55
2013-04-28 18:30:10 2013-04-28 18:31:56
2013-04-28 18:32:01 2013-04-28 18:32:01
2013-04-28 18:32:42 2013-04-28 18:33:20
2013-04-28 18:33:28 2013-04-28 18:33:56
2013-04-28 18:34:04 2013-04-28 18:34:04
2013-04-28 18:35:50 2013-04-28 18:37:04
2013-04-28 18:38:23 2013-04-28 18:38:45
2013-04-28 18:50:59 2013-04-28 18:50:59
2013-04-28 18:52:22 2013-04-28 18:52:22
2013-04-28 18:52:37 2013-04-28 18:52:37
2013-04-28 19:01:29 2013-04-28 19:01:29
2013-04-28 19:03:03 2013-04-28 19:03:43
2013-04-28 19:04:02 2013-04-28 19:08:23
2013-04-28 19:19:39 2013-04-28 19:19:39
2013-04-28 19:24:02 2013-04-28 19:25:20
2013-04-28 19:29:05 2013-04-28 19:29:05
2013-04-28 19:32:52 2013-04-28 19:32:52
2013-04-28 19:35:14 2013-04-28 19:36:11
2013-04-28 19:37:09 2013-04-28 19:37:09
2013-04-28 19:51:33 2013-04-28 19:52:27
2013-04-28 19:51:41 2013-04-28 19:53:17
2013-04-28 19:51:55 2013-04-28 19:53:56
2013-04-28 19:55:52 2013-04-28 20:04:13
2013-04-28 19:57:24 2013-04-28 19:59:12
2013-04-28 19:58:46 2013-04-28 19:58:46
2013-04-28 20:00:29 2013-04-28 20:00:29
2013-04-28 20:03:00 2013-04-28 20:03:00
2013-04-28 20:03:12 2013-04-28 20:03:12
2013-04-28 20:04:48 2013-04-28 20:07:26
2013-04-28 20:05:20 2013-04-28 20:05:36
2013-04-28 20:05:53 2013-04-28 20:06:33
2013-04-28 20:06:54 2013-04-28 20:07:00
2013-04-28 20:10:14 2013-04-28 20:10:14
2013-04-28 20:13:41 2013-04-28 20:20:33
2013-04-28 20:18:16 2013-04-28 20:18:44
2013-04-28 20:21:00 2013-04-28 20:21:57
2013-04-28 20:22:47 2013-04-28 20:22:47
2013-04-28 20:24:20 2013-04-28 20:25:32
2013-04-28 20:43:45 2013-04-28 20:47:11
2013-04-28 20:48:13 2013-04-28 20:48:50
2013-04-28 20:50:46 2013-04-28 20:54:53
2013-04-28 20:53:51 2013-04-28 20:53:51
2013-04-28 20:53:51 2013-04-28 20:56:12
2013-04-28 20:57:30 2013-04-28 20:59:14
2013-04-28 21:00:14 2013-04-28 21:00:36
2013-04-28 21:06:35 2013-04-28 21:06:35
2013-04-28 21:14:29 2013-04-28 21:17:09
2013-04-28 21:19:10 2013-04-28 21:19:10
2013-04-28 21:34:47 2013-04-28 21:34:47
2013-04-28 21:43:19 2013-04-28 21:45:13
2013-04-28 21:45:51 2013-04-28 21:48:48
2013-04-28 21:47:15 2013-04-28 21:47:15
2013-04-28 21:49:25 2013-04-28 21:50:25
2013-04-28 21:54:34 2013-04-28 21:54:34
2013-04-28 21:55:57 2013-04-28 21:58:42
2013-04-28 21:56:47 2013-04-28 21:58:25
2013-04-28 22:07:20 2013-04-28 22:08:12
2013-04-28 22:16:57 2013-04-28 22:16:57
2013-04-28 22:17:16 2013-04-28 22:28:09
2013-04-28 22:39:42 2013-04-28 22:39:42
2013-04-28 22:43:00 2013-04-28 22:44:06
2013-04-28 22:44:51 2013-04-28 22:44:51
2013-04-28 22:46:01 2013-04-28 22:55:46
2013-04-28 22:48:32 2013-04-28 22:50:45
2013-04-28 22:52:39 2013-04-28 22:53:48
2013-04-28 23:04:40 2013-04-28 23:04:48
2013-04-28 23:44:11 2013-04-28 23:45:02
2013-04-28 23:45:30 2013-04-28 23:45:30
2013-04-28 23:48:32 2013-04-28 23:48:32
2013-04-28 23:48:52 2013-04-28 23:48:52
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #333b53;
}
</style>
<script src="//d3js.org/d3.v3.min.js"></script>
</head>
<body>
<div id="viz"></div>
<script type="text/javascript">
d3.csv("dialogs.csv", function(data) {
var raws = new Array();
data.forEach(function(d){
d.START = new Date(d.START);
d.END = new Date(d.END);
raws.push(d);
});
raws.sort(function(a, b){ return d3.ascending(a.START, b.START);});
var layers = new Array();
var temp = new Array();
temp.push(raws[0]);
layers.push(temp);
for(var i = 1; i < raws.length;i++){
var current = raws[i];
var inserted = false;
for(var l = 0; l < layers.length; l++){
var last = layers[l][layers[l].length-1];
if(last != undefined && current.START > last.END){
layers[l].push(current);
inserted = true;
break;
}
}
if(inserted == false){
var newLayer = new Array();
newLayer.push(current);
layers.push(newLayer);
}
last = current;
}
var min = d3.min(raws,function(d){return d.START});
var max = d3.max(raws,function(d){return d.END});
var xScale = d3.time.scale().domain([min,max])
.range([0,860]);
var yScale = d3.scale.linear().domain([0,layers.length])
.range([0,400]);
var svg = d3.select("#viz")
.append("svg:svg")
.attr("width", 860)
.attr("height", 400);
for(var i = 0 ; i < layers.length;i++){
svg.selectAll("line" + i)
.data(layers[i])
.enter()
.append("line")
.attr("x1", function(d) {
return xScale(d.START);
})
.attr("x2", function(d) {
return xScale(d.END);
})
.attr("y1", 20 + i*12)
.attr("y2", 20 + i*12)
.attr("class", function(d) {
return d.START + "->" + d.END;
})
.style("stroke","#e5d5a6")
.style("stroke-width","10");
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment