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

Allow selected points where canvas-y coordinate is 0 #692

Merged
merged 4 commits into from
Nov 16, 2015

Conversation

musicist288
Copy link
Contributor

As discussed in #691

The check for utils.isOK blacklists the value 0. In the context of
validating selected points and reporting them in the legend, any point
where canvas-y zero should be included.

@musicist288
Copy link
Contributor Author

Not sure why this failed. The tests all ran and passed but some post test step failed.

The GITHUB_TOKEN environment variable must be set.

@@ -1815,7 +1815,7 @@ Dygraph.prototype.updateSelection_ = function(opt_animFraction) {
ctx.save();
for (i = 0; i < this.selPoints_.length; i++) {
var pt = this.selPoints_[i];
if (!utils.isOK(pt.canvasy)) continue;
if (isNaN(pt.canvasy) || pt.canvasy === null) continue;
Copy link
Owner

Choose a reason for hiding this comment

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

I think you also want to check for undefined here (and in legend.js), unless there's a reason for that to be excluded?

This returns true unless the parameter is 0, null, undefined or NaN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I actually have a question about that, what is the distinction between undefined and null for canvas points?

Copy link
Owner

Choose a reason for hiding this comment

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

To be honest, I don't see how either would happen. They get set in dygraph-canvas.js:

      point.canvasx = this.area.w * point.x + this.area.x;
      point.canvasy = this.area.h * point.y + this.area.y;

If point.x is null, then we get:

> 600 * null
0

whereas

> 600 * undefined
NaN

this is... strange. But since it never comes out to null or undefined, I'd guess that those checks aren't necessary.

@danvk
Copy link
Owner

danvk commented Nov 16, 2015

Any reason for chmoding the test files? (They go from 644→755.)

@danvk danvk mentioned this pull request Nov 16, 2015
@musicist288
Copy link
Contributor Author

No reason for the chmod. I'll change them back. It's something that my editor or VM is doing and I let it slip through accidentally.

Joseph Rossi added 3 commits November 16, 2015 15:49
This test demonstrates how updateSelection_ and generateLegendHTML
were ignoring points whose canvas-y value was 0. The next commit will
fix these breaking tests
The check for `utils.isOK` blacklists the value 0. In the context of
validating selected points and reporting them in the legend, any point
where canvas-y zero should be included.
@danvk
Copy link
Owner

danvk commented Nov 16, 2015

Try pulling master and rebasing your branch. You'll pick up #693, which should make the test failure go away.

@musicist288
Copy link
Contributor Author

Ok thanks. That seemed to work. I also updated the request with the reverted file modes and the check for undefined.

@danvk
Copy link
Owner

danvk commented Nov 16, 2015

Can you try dropping the || pt.canvasy === null || pt.canvasy === undefined clause from both checks and running the tests? Looking at that canvasy logic, I just don't see how those two values are possible.

@musicist288
Copy link
Contributor Author

Ok. Updated and tests pass.

@danvk
Copy link
Owner

danvk commented Nov 16, 2015

Perfect, thanks! We'll see if anyone complains.

danvk added a commit that referenced this pull request Nov 16, 2015
Allow selected points where canvas-y coordinate is 0
@danvk danvk merged commit dd74404 into danvk:master Nov 16, 2015
@musicist288 musicist288 deleted the zero-coordinate-bugs branch November 19, 2015 13:58
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

Successfully merging this pull request may close these issues.

2 participants