Skip to content

Instantly share code, notes, and snippets.

@gordonwoodhull
Last active September 13, 2016 08:11
Show Gist options
  • Save gordonwoodhull/b38798ee5e07c9cc6633752bd89983cf to your computer and use it in GitHub Desktop.
Save gordonwoodhull/b38798ee5e07c9cc6633752bd89983cf to your computer and use it in GitHub Desktop.
fresh block
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.12/crossfilter.js"></script>
<script src="http://dc-js.github.io/dc.js/js/d3.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
test_data = [{date: 12, cnt: 1},
{date: 11, cnt: 2},
{date: 12, cnt: 3}],
test_ndx = crossfilter(test_data),
test_dim = test_ndx.dimension(function(d) { return d.date; }),
test_grp = test_dim.group(function(d) { return -d; });
console.log(test_grp.all())
simp_grp = test_dim.group();
console.log(simp_grp.all().map(function(kv) { return new Date(kv.key)}))
//debugger
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment