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

Row Chart Sorting #384

Closed
bhatup opened this issue Oct 31, 2013 · 3 comments
Closed

Row Chart Sorting #384

bhatup opened this issue Oct 31, 2013 · 3 comments
Labels

Comments

@bhatup
Copy link

bhatup commented Oct 31, 2013

Hi,

I want to sort a row chart with the rows with the highest value at the top and descending and trying like below: group.order(orderValue)
reference: https://github.com/square/crossfilter/wiki/API-Reference#wiki-group_order

This works for bar chart. but not with row chart.

I tried with below too, but It is not working for me:
https://groups.google.com/forum/#!topic/dc-js-user-group/MQgmjqYDxTU

Someone suggested me about chart.ordering. but I don't know how to use it.

Can you please suggest me something, so that I can sort a row chart with the rows with the highest value at the top?

@jefffriesen
Copy link

I was the one who asked it in the google group. It does work for me. I'll post my code here in case that helps. I'm using

  • dc.js 1.6.0
  • d3.js 3.3.9
  • crossfilter 1.3.4
var company = xf.dimension(function(d) {return d.company });
var companyGroup = company.group().reduceCount()

companyChart
        .width(300)
        .height(2500)
        .margins({top: 5, left: 10, right: 10, bottom: 20})
        .dimension(company)
        .group(companyGroup)
        .colors(["rgba(86, 61, 124, 0.25)"])
        .gap(1)
        .label(function (d) { return d.key })
        .title(function (d) { return d.value })
        .x(d3.scale.linear().domain([0, .25]))
        .ordering(function(d) { return -d.value })

@bhatup
Copy link
Author

bhatup commented Nov 1, 2013

Thank you so much, it works..!!
👍

@bhatup bhatup closed this as completed Nov 1, 2013
@jadhavpamu2020
Copy link

Thank you so much, it works..!!

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

No branches or pull requests

3 participants