score:7

Could you show us some code ?

In the past I have done that this way for a row chart :

var topRowChart = dc.rowChart("#chart-top-dest");

topRowChart
.height(400)
.width(400)
.dimension(destination, "destination")
.group(calls,"calls")
.ordering(function(t){return t.calls;})
.label(function(d){ return d.key + " : " + d.value + " calls" ;})
.cap(10);

The important bits are :

.ordering(function(t){return t.calls;})
.cap(10);

You have to pass a function to ordering() that returns the dimension/group that will be used for sorting.

Surprisingly removing cap() cancels the sorting.


Related Query

More Query from same tag