Skip to content

Instantly share code, notes, and snippets.

@benheb
Created February 28, 2013 19:14
Show Gist options
  • Save benheb/5059270 to your computer and use it in GitHub Desktop.
Save benheb/5059270 to your computer and use it in GitHub Desktop.
var prev = this._numeric_resolution;
var min = this.visibleDataExtent[0];
var range = this.visibleDataExtent[1] - this.visibleDataExtent[0];
this._resolution = this._findRes( range );
this._numeric_resolution = this._resolutions[this._resolution];
var counter = {};
this.bins.forEach(function(n,i) {
var time = min + (i * prev);
var index = new Date(time).getHours(); //Math.floor(time);
if ( !counter[ index ] ) counter[ index ] = 0;
counter[ index ] += n;
});
console.log('counter', counter);
var data = Object.keys(counter).map(function(k) { return counter[k] });
console.log(data)
this.bins = data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment