Accepted answer

Two things:

  1. Pass dc.units.ordinal as the parameter to .xUnits().
  2. Pass an ordinal scale function to .x().

Here's what I mean:

.x(d3.scale.ordinal().domain(["", "a", "b", "c"])) // Need empty val to offset first value
.xUnits(dc.units.ordinal) // Tell dc.js that we're using an ordinal x-axis

See this JSFiddle:

For some reason, I couldn't get renderHorizontalGridLines() or renderVerticalGridLines() to work, but the rest is good.



.x(d3.scale.ordinal().domain( (d) {return d.Alphabet_Type; })))

solved the problem.

Related Query

More Query from same tag