Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordinal rangePoints are ignored #18

Closed
heavysixer opened this issue Jul 14, 2014 · 0 comments
Closed

Ordinal rangePoints are ignored #18

heavysixer opened this issue Jul 14, 2014 · 0 comments
Assignees
Labels

Comments

@heavysixer
Copy link
Owner

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);
@heavysixer heavysixer added the bug label Jul 14, 2014
@heavysixer heavysixer self-assigned this Jul 14, 2014
heavysixer added a commit that referenced this issue Jul 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant