Fix type of keyFunction in d3.nest().key(keyFunction)

This commit is contained in:
Utkarsh Upadhyay
2013-07-14 22:40:12 +02:00
parent 253488be2a
commit 7525e6f5d4
2 changed files with 2 additions and 2 deletions

View File

@@ -788,7 +788,7 @@ function populationPyramid() {
// Produce a map from year and birthyear to [male, female].
data = d3.nest()
.key(function (d) { return d.year; } )
.key(function (d) { return d.year - d.age; } )
.key(function (d) { return '' + (d.year - d.age); } )
.rollup(function (v) { return v.map(function (d) { return d.people; } ); } )
.map(data);

2
d3/d3.d.ts vendored
View File

@@ -755,7 +755,7 @@ declare module D3 {
}
export interface Nest {
key(keyFunction: (data: any, index: number) => any): Nest;
key(keyFunction: (data: any, index: number) => string): Nest;
sortKeys(comparator: (d1: any, d2: any) => number): Nest;
sortValues(comparator: (d1: any, d2: any) => number): Nest;
rollup(rollupFunction: (data: any, index: number) => any): Nest;