Skip to content

Commit

Permalink
small refinement to how hash collisions work
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdickinson committed Jun 26, 2012
1 parent a33ffcd commit 03dab86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/seasons.js
Expand Up @@ -69,7 +69,7 @@ define(function(require) {
line
.exit()
.attr('class', 'inactive seasons-line')

var hashes = {}

for(var i = 0, len = data[idx].data.length; i < len; ++i) {
Expand All @@ -78,7 +78,8 @@ define(function(require) {
hashes[data[idx].data[i].hash]++

if(hashes[data[idx].data[i].hash] > 1) {
data[idx].data[i].hash = data[idx].data[i].hash+':'+data[idx].data[i].num
var prev = data[idx].data[i-1] || {hash:data[idx].data[i].line}
data[idx].data[i].newhash = data[idx].data[i].hash+':'+(prev.newhash || prev.hash)
}
}

Expand All @@ -88,13 +89,14 @@ define(function(require) {
}

function key_fn(d) {
return d.hash
return d.newhash || d.hash
}
}

function top_fn(d) {
return d.num * line_height + 'px'
}

}

function line_no(d) {
Expand Down
2 changes: 1 addition & 1 deletion seasons.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03dab86

Please sign in to comment.