Accepted answer

You've got a few issues in here.

First, you've got NaNs in the data you're aggregating, so you'll need to change your YDimension to something like

var YDimension = (d) {return isNaN( ? 0 :;});

to get Crossfilter to sum it properly.

The actual answer, though, is about your x scale. You're currently just not including one, but it sounds like what you're talking about is an Ordinal Scale. Ordinal scales are the scales you typically think of for bar charts; they're a type of scale that has a discrete domain. In this case, you could try adding an ordinal scale like so:

.x(d3.scale.ordinal().domain(["visa", "cash", "tab"]))

so it uses an ordinal scale instead. Since you're using dc.js, you'll also need to specify


so that it knows to use ordinal marks.

Overall, I used

    .x(d3.scale.ordinal().domain(["visa", "cash", "tab"]))

and it worked fine on my end. Depending on your dc.js version, you may be able to omit the domain and let dc.js figure it out automatically. In that case, you could just use


Related Query

More Query from same tag