bashhike
bashhike

Reputation: 129

DC.js Ordering with filters

Hi I am ordering the x values in my bar chart with .ordering. It orders correctly. However on filtering on other linked charts the ordering doesn't change. How do I achieve this behaviour?

Also ordering for me only works when I am overriding the default groupX.all() function with

groupX.all = function() {
  return groupX.top(Infinity);
}

How can I make my bar chart order itself everytime it's redrawn?

Upvotes: 1

Views: 122

Answers (1)

Gordon
Gordon

Reputation: 20120

How about this (untested):

chart.on('preRedraw', function() {
    chart.rescale();
});

Since the ordering is implemented via the X scale, this should get the chart to recompute the scale each time.

Upvotes: 0

Related Questions