Ordinal rangePoints are ignored
heavysixer opened this issue · comments
Ordinal rangePoints are ignored when being applied in this manner:
.x(function(x){
x
.domain(data)
.rangePoints([0, chart.width()],1);
// this produces the correct range but is reverted when the chart is rendered.
console.log(x.rangePoints([0, chart.width()],1).range())
})
More than likely this is also a problem with other scale setters as well.
You can see an example of the reverted scale range using this simple feature:
d4.feature('pathSeries', function(name) {
return {
accessors: {
classes: function(){
return 'path';
}
},
render: function(scope, data, selection) {
selection.append('g').attr('class', name);
var group = selection.select('.' + name).selectAll('g').data(data);
group.exit().remove();
group.enter().append('g');
var path = group.selectAll('path')
.data(function(d){
return d.values;
});
path.enter().append('path')
.attr('class', d4.functor(scope.accessors.classes).bind(this))
.attr('transform', function(d) {
// produces the wrong value
console.log(this.x(d))
this.x.rangePoints([0, this.width],1);
// produces the correct value
console.log(this.x(d))
return 'translate(' + this.x(d) + ',' + (this.height / 2) + ')';
}.bind(this))
.attr('d', d3.svg.symbol().type(String).size(this.height));
}
};
}).call(this);