Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .sort() #1

Open
jstcki opened this issue May 31, 2013 · 3 comments
Open

Add .sort() #1

jstcki opened this issue May 31, 2013 · 3 comments

Comments

@jstcki
Copy link
Contributor

jstcki commented May 31, 2013

No description provided.

@grossbart
Copy link

And boom, it'll be Isotope for d3. :)

@ejfox
Copy link

ejfox commented Jul 27, 2016

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.

@jstcki
Copy link
Contributor Author

jstcki commented Jul 28, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants