Skip to content

Commit

Permalink
Key for intervals data.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderby committed Aug 23, 2016
1 parent b43f793 commit 3c7dd83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/elements/element.interval.js
Expand Up @@ -201,7 +201,7 @@ export class Interval extends Element {
var elements = options
.container
.selectAll('.frame')
.data(fibers);
.data(fibers, (d) => d.getKey());
elements
.exit()
.remove();
Expand Down
11 changes: 9 additions & 2 deletions src/models/cartesian-grammar.js
Expand Up @@ -402,7 +402,7 @@ export class CartesianGrammar {
return (Object
.keys(groups)
.sort((a, b) => model.order(a) - model.order(b))
.reduce((memo, k) => memo.concat([groups[k]]), []));
.reduce((memo, k) => memo.concat([setKeyGetter(groups[k], k)]), []));
}

static isNonSyntheticRecord(row) {
Expand Down Expand Up @@ -449,4 +449,11 @@ export class CartesianGrammar {
},
[]));
}
}
}

function setKeyGetter(arr, key) {
arr.getKey = function () {
return key;
};
return arr;
}

0 comments on commit 3c7dd83

Please sign in to comment.