Skip to content

Carpet plot rebase #1595

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

Merged
merged 23 commits into from
Apr 17, 2017
Merged

Carpet plot rebase #1595

merged 23 commits into from
Apr 17, 2017

Conversation

rreusser
Copy link
Contributor

This PR breaks up a couple not-really-related or loosely-related commits from carpet plots into separate commits and rebases all of carpet plots into one big commit. Supersedes #1239.

@rreusser rreusser mentioned this pull request Apr 13, 2017
44 tasks
@etpinard etpinard added this to the v1.26.0 milestone Apr 13, 2017
@@ -14,6 +14,7 @@ var extendFlat = require('../../../lib/extend').extendFlat;


module.exports = {
visible: axesAttrs.visible,
Copy link
Contributor

Choose a reason for hiding this comment

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

visible for 3D axes doesn't actually works, correct?

I think you had to put it in there so that supplyDefaults doesn't error out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, correct. Was contemplating the best option as was working back through that. Correct though, it was just to make them not fail.

Copy link
Contributor Author

@rreusser rreusser Apr 13, 2017

Choose a reason for hiding this comment

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

Perhaps the right answer is not to remove the attribute and avoid supplying that default in that case.

Copy link
Contributor

Choose a reason for hiding this comment

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

scene.?axis.visible: false would be a nice option too. So I don't think it's worth changing the logic. Opening a new issue about implementing ?axis.visible in 3D will suffice.

Copy link
Contributor

Choose a reason for hiding this comment

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

done in #1599

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh wow, nice!

Copy link
Contributor

Choose a reason for hiding this comment

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

#1599 is now merged in this PR.

@etpinard
Copy link
Contributor

PR of the year candidate 🏆

@rreusser
Copy link
Contributor Author

giphy_360


// If too long, truncate. (If too short, it will grow
// automatically so we don't care about that case)
out.length = n;
Copy link
Collaborator

Choose a reason for hiding this comment

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

huh, never knew you could resize this way!

Copy link
Contributor Author

@rreusser rreusser Apr 13, 2017

Choose a reason for hiding this comment

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

Best I can tell, it's actually robust and supported across platforms. It's possible it does weird things internally (like not actually de-allocating that memory. I saw a while ago some discussion of the various internal string apis and string data structures in js. Hint: it's not straightforward). The main goal was to just overwrite the carpet spline stuff rather than allocating everything from scratch every time since that adds up to lots of garbage collection.

Copy link
Contributor

@etpinard etpinard Apr 13, 2017

Choose a reason for hiding this comment

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

From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/length

The array length property sets or returns the number of elements in an array.

That's right, [..] sets or returns [..].

It's not a read-only property like one might assume.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(best-case scenario though is that it actually truncates in-place without actually copying. I mean maybe copies, but slice() definitely copies.)

var bbox = drawing.bBox(dummyText.node());
dummyText.remove();
return bbox;
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see why you did it this way, but it seems a little redundant, we're making a new node only to clone it in the global tester, then we delete them both. If this ends up getting called a lot, for performance we may want to break up drawing.bBox in such a way that this element can get created in the global tester in the first place.

Copy link
Contributor Author

@rreusser rreusser Apr 13, 2017

Choose a reason for hiding this comment

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

That makes sense. I didn't appreciate that the tester was also cloning it. And to add to that, it looks like I only ended up using it in one place. 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(but on the plus side, to answer your question, at least it doesn't end up getting called a lot 😄 )

expect(traceOut.db).toBeUndefined();
expect(traceOut.a0).toBeUndefined();
expect(traceOut.b0).toBeUndefined();
expect(traceOut.visible).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

@rreusser looks like only this assertion fails when removing the if(!test.supplyDefaults) return; statement above.

Copy link
Contributor

Choose a reason for hiding this comment

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

by the way @rreusser I'm adding a few restyle test cases on a branch, so I can take care of ⤴️ if you like.

Copy link
Contributor Author

@rreusser rreusser Apr 13, 2017

Choose a reason for hiding this comment

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

If you're already editing it, then 👍 . I think most of the carpet tests should actually be moved out of this file since a lot of the functions being tested are better suited for lib.

Copy link
Contributor

Choose a reason for hiding this comment

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

done in c98553a

@etpinard etpinard mentioned this pull request Apr 14, 2017
@etpinard
Copy link
Contributor

@rreusser a well-earned 💃

Not sure if @alexcjohnson 's #1595 (comment) is blocking though.


🎉 🚀 🚀 🚀 🚀 🚀 🚀 🚀 🚀 🎉

@alexcjohnson
Copy link
Collaborator

Not sure if @alexcjohnson 's #1595 (comment) is blocking though.

Nah, if it only gets sparing use it's not blocking. Awesome work @rreusser & @etpinard !

@rreusser
Copy link
Contributor Author

rreusser commented Apr 17, 2017

Removed nonetheless. You're correct that it really wasn't needed there and wasn't used elsewhere. 👍

@rreusser rreusser merged commit ba0e3a5 into master Apr 17, 2017
@rreusser rreusser deleted the carpet-rebase branch April 17, 2017 15:17
@etpinard etpinard mentioned this pull request Jun 28, 2017
baxis: extendFlat({}, axisAttrs),
font: {
family: extendFlat({}, fontAttrs.family, {
dflt: '"Open Sans", verdana, arial, sans-serif'
Copy link
Collaborator

Choose a reason for hiding this comment

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

@rreusser a little late for me to notice this, but is there a reason this font gets its own defaults? Is it too late to make this inherit from the global layout.font? I see that the various axis fonts inherit from this, which is great.
cc @etpinard

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good point. Yes, I valid to make the switch now. Though it's technically a change, I think the number of actual breakages would be outweighed by API consistency.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great - I just noticed some of these things as I'm pushing more of the restyle/relayout logic into the schema... I'll take care of these after I'm done with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it too late to make this inherit from the global layout.font?

Nop, not too late. I'd call this a bug fix.

].join(' ')
},

fixedrange: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@rreusser does fixedrange do anything on a carpet axis? Can I remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🔪

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

Successfully merging this pull request may close these issues.

3 participants