Bubble Chart Fail
by DJ Martin
HTML
<link rel="stylesheet" href="http://dc-js.github.io/dc.js/css/dc.css">
<link rel="stylesheet" href="http://dc-js.github.io/dc.js/css/bootstrap.min.css">
<script src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script>
<script src="http://dc-js.github.io/dc.js/js/dc.js"></script>
<div id="dc-bar"></div>
JavaScript
var jsonstr = [{"timestamp": "2013-06-13T11:04:24.729Z"},{"timestamp": "2013-06-17T11:03:24.729Z"},{"timestamp": "2013-06-17T11:02:24.729Z"},{"timestamp": "2013-06-19T11:02:14.129Z"}];
var ndx = crossfilter(jsonstr);
var timestampD = ndx.dimension(function (d) {
return new Date(d.timestamp);
});
var timestampDG = timestampD.group(function (d) {
return d3.time.day(d);
});
var barChart = dc.barChart("#dc-bar");
barChart.width(500)
.height(250)
.dimension(timestampD)
.group(timestampDG)
.x(d3.time.scale().domain([(new Date(2013,05,12)), (new Date(2013,05,20))]).nice(d3.time.day))
.xAxis().tickFormat(function (x) {
return x.getDate() + "/" + (x.getMonth()+1);
});
dc.renderAll();