d3-grid
d3-grid copied to clipboard
Add .sort()
And boom, it'll be Isotope for d3. :)
I'm working on a project where I am basically doing this, any interest in a PR to try and integrate underscore's _.sortBy (will just pull it out)?
I'm imagining something like
data = [
{
name: 'one',
id: 1,
value: 5
},
{
name: 'two',
id: 2,
value: 3
},
{
name: 'three',
id: 3,
value: 1
}
]
pointGrid = d3.layout.grid()
.points()
.size([width-100,height-100])
.data(data)
.sortBy(function(d){
return -d.id
})
pointGrid.sortBy('value')
and then update/append/remove normally.
Wow, what a blast from the past, this issue is three years old! 😄
Does this library even need this feature? Isn't it easier to just sort the data (using d3.ascending, underscore, whatever you like …) before passing it into the layout function? See http://bl.ocks.org/herrstucki/5694697