Skip to content
Gordon Woodhull edited this page Apr 5, 2014 · 3 revisions

dc.js Frequently Asked Questions

How do I...?

  • Reuse custom reduce functions? dc.js uses Crossfilter's generic group reduce to let you specify initialize, add, and remove functions for custom aggregation of groups. Typically, these are anonymous inline functions with field names hardcoded, but you can instead use a closure to return such a function with custom parameters.

  • Tell whether my groups are functioning correctly / whether my input data is good? Set a breakpoint on the chart initialization, after the groups are created. Run group.all() in the debug console and see whether the keys and values make sense.

Why the heck...?

  • Is the data returned from d3.csv or d3.json undefined? Make sure you are using the data within the callback from the function. These functions return immediately and the data will not be defined outside of the callback. Once the data fetch and parsing has been done, the callback will be called.

  • Are my bars one pixel wide? Check that you have set .xUnits on your chart. The parameter should be one of the dc.units helpers.

  • Does everything break after a call to .xAxis?? xAxis returns an axis object which is not the chart.

Clone this wiki locally