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

- fix issue scattergl and fill to zero and undefined value #2965

Closed
wants to merge 1 commit into from
Closed

- fix issue scattergl and fill to zero and undefined value #2965

wants to merge 1 commit into from

Conversation

ErwanMAS
Copy link
Contributor

@ErwanMAS ErwanMAS commented Sep 3, 2018

Example of the issue => https://codepen.io/erwanmas/pen/aaJXLY

When we add the first point and the last point , we must be sure that the first/last point does not have a NaN value .

@alexcjohnson
Copy link
Collaborator

Thanks for the PR (and demonstration of the issue) @ErwanMAS ! Looks like a good solution to me, just two things I'd like to add to it:

  • Can you include a few more invalid values in the mock - undefined, '', 'N/A' perhaps? I'm assuming they've all been turned into the same value by the time we get to your new code, but while we're here lets verify that.
  • Do the same for tozerox

}
var lastdef = srcPos.length - 1;
while(isNaN(srcPos[lastdef])) {
lastdef += -2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-= 2?

lastdef += -2;
}
pos = [ srcPos[firstdef - 1], 0 ];
pos = pos.concat(srcPos.slice(firstdef - 1, lastdef + 1));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐎 so we don't need to slice unnecessarily, can we keep track of whether there actually were invalid points on either end?

}
pos = [ srcPos[firstdef - 1], 0 ];
pos = pos.concat(srcPos.slice(firstdef - 1, lastdef + 1));
pos = pos.concat([ srcPos[lastdef - 1], 0 ]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice the existing code didn't take advantage of this, but push is variadic:
pos.push(srcPos[lastdef - 1], 0);

pos.push(srcPos[srcPos.length - 2]);
pos.push(0);
var firstdef = 1;
while(isNaN(srcPos[firstdef])) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh hmm - this checks for invalid y, what about invalid x?

@@ -0,0 +1,52 @@
{
"data": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind renaming this mock gl2d_fill_trace.json? We like to prefix gl-based mocks by either gl2d_ or gl3d_.

Would should probably write down in the CONTRIBUTING file at some point.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point for this PR - but rather than describing this in CONTRIBUTING.md how about we make the image test system support subfolders and give them a little more organization? It's getting impossible to find what you want in mocks and baselines...

@ErwanMAS
Copy link
Contributor Author

ErwanMAS commented Sep 7, 2018

i create a new pull request [#2979]

@ErwanMAS ErwanMAS closed this Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants