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

Rectangle Plot Error: postScale is not a function (replicated in codesandbox) #3473

Open
riley-steele-parsons opened this issue Jul 20, 2018 · 2 comments

Comments

@riley-steele-parsons
Copy link

Hello. I'm attempting to render a plottable.js rectangle plot within a React app. I repeatedly am seeing the same error:

TypeError
postScale is not a function
postScaledAccesor
./node_modules/plottable/build/src/plots/plot.js:777:42

I've replicated this same error within the Mondrian example inside of a codesandbox, see below.

Bug report

Live example URL: https://codesandbox.io/s/xlqn2mnwyw

Expected behavior

It should render properly.

Actual behavior

It does not.

  • Plottable version: 3.8.3
  • Browser name/version: Chrome
  • OS name/version: N/A
@pasndrp
Copy link

pasndrp commented Jul 31, 2018

I encountered the same issue while migrating from an old version of plottable to 3.8.x. This can be traced back to changes made to the arguments of the functions Rectangle.prototype.x2 = function (x2, postScale) {...} and Rectangle.prototype.y2 = function (y2, postScale) {...}.

You can fix your example by excluding xScale and yScale respectively from said functions:

...
var plot = new Plottable.Plots.Rectangle();
plot.addDataset(new Plottable.Dataset(data));
plot
   .x(function(d) {
      return d.x;
   }, xScale)
   .y(function(d) {
      return d.y;
   }, yScale)
   .x2(function(d) {
      return d.x2;
   })
   .y2(function(d) {
      return d.y2;
   })
   .attr("fill", function(d) {
      return d.fill;
   })
   .attr("stroke", function() {
      return "#000000";
   })
   .attr("stroke-width", function() {
      return 4;
   });
plot.renderTo(this._rootNode);
...

@riley-steele-parsons
Copy link
Author

@themadcreator, can you comment as to whether this is expected behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants