mbostock/d3 — Issue #420: d3.{min,max,extent} should return the object, not the value.
Author: mbostock
Created: 2011-12-30 18:29:55+00:00
State: open
Labels: req

Currently, the accessor function to d3.min and related functions behaves as an implicit map. But there are times when you want to retrieve the object with the minimum value, rather than the value itself. (There are also times where you want the index, which we could do as d3.min.index, similar to Protovis.)

So, rather than:

```javascript
d3.min(data, function(d) { return d.x; })
```

You would say:

```javascript
d3.min(data.map(function(d) { return d.x; }))
```

This would be equivalent, but we should prefer the version with array.map for computing scale domains and such:

```javascript
d3.min(data, function(d) { return d.x; }).x
```

Unfortunately, this change is not backwards compatible, so we'd need a major version bump.