1

I wanted to comment on the following: Conditional coloring in dc charts

How can we define the lower and upper bounds of a colorDomain to reflect automatically the min and max values of a specific group ? For instance applying a filter, I want to make sure that I use the gradient of colors green to red even if the min and max values after filter have changed.

Should I use reductio to capture the reactive min and max values ?

Community
  • 1
  • 1

1 Answers1

0

This is not done automatically because often the colors will have absolute meanings and should not be rescaled. It's very much like elasticX and elasticY.

It's pretty easy to calculate it automatically - just set an event handler to call calculateColorDomain each time the chart is redrawn:

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

It should really be an option.

Gordon
  • 19,811
  • 4
  • 36
  • 74