Ordinary axis position DC.js scatterPlot

How can I position value points directly above ticks (or ticks directly below points) using DC.js. I could not do this, DC.js (or D3.js) positions the values ​​shifted to the left of the ticks, although the X value is exactly the tick value.

Important: I need this function for the ordinal axis X (it works fine for the linear axis X)!

incorrect data / checkmark position

var data = [
  {"x":"a","y":1},
  {"x":"b","y":2},
  {"x":"c","y":3}
];
...
dc.scatterPlot("#mychart")
  .dimension(dimension) 
  .group(group) 
  .x(d3.scale.ordinal().domain(data.map(function(v) {return v.x})))
  .xUnits(dc.units.ordinal) 
  .valueAccessor(function(d) {return d.value;});

Full code: jsfiddle: http://jsfiddle.net/bourbert/59Lmt98w/1/

+4
source share
1 answer

In dc.js Bubble Chart change bubbleLocator:

var bubbleLocator = function (d) {
return 'translate(' + (bubbleX(d)+20) + ',' + (bubbleY(d)) + ')';
};
0
source

All Articles