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

Add width/height as a top level specification for CQL queries. #415

Merged
merged 11 commits into from Dec 6, 2017

Conversation

haldenl
Copy link
Contributor

@haldenl haldenl commented Nov 9, 2017

Width height can be specified to control the dimensions of the output vega-lite specs that come out of recommend. See issue #332

@haldenl haldenl requested a review from kanitw November 9, 2017 12:50
Copy link
Member

@kanitw kanitw left a comment

Choose a reason for hiding this comment

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

I think we should add this to shorthand somehow too. Maybe as |width=100|height=100 or something.

* Thus the `encoding` object in Vega-Lite is flatten as the `encodings` array in CompassQL.
*/
encodings: EncodingQuery[];

/**
Copy link
Member

Choose a reason for hiding this comment

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

Remove the JSDoc comment or change it to normal comment (// width and height//?

Note that this comment would be only applied to height when you hover over width variable. So if we have descriptive comment, better make them separate for width / height. However, if the width property's JSDocs is simply "width", there is no point adding it.

Copy link
Member

Choose a reason for hiding this comment

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

I think a good JSDocs note for these two variables are that width cannot be wildcard (yet). Same for height.

(I don't think we need to implement them as wildcard yet as there is no required use case.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@kanitw
Copy link
Member

kanitw commented Nov 21, 2017

Still need to do this?

I think we should add this to shorthand somehow too. Maybe as |width=100|height=100 or something.

And maybe test if this really works in the editor, if it works, capture a screenshot then I think we should be good to go.

@haldenl
Copy link
Contributor Author

haldenl commented Nov 21, 2017

Oh yes, I missed that comment, sorry. Should be done! Here's a screenshot.
screen shot 2017-11-21 at 6 32 55 am

@@ -134,6 +134,13 @@ export function spec(specQ: SpecQuery,
}
}

if (!!specQ.width) {
Copy link
Member

Choose a reason for hiding this comment

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

I think you have to take include into account here too.

(I also notice that we forgot to do the same for transform above -- please help fix that too -- maybe in a separate PR.)

* Thus the `encoding` object in Vega-Lite is flatten as the `encodings` array in CompassQL.
*/
encodings: EncodingQuery[];

/**
* The width of the resulting encodings, does not support wildcards.
Copy link
Member

Choose a reason for hiding this comment

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

I think splitting the sentence makes it a bit easier to read :)

The width of the resulting encodings.

__Note:__ This property does not support wildcards.

@kanitw
Copy link
Member

kanitw commented Nov 21, 2017

One thing that I start wondering is whether we should add other top-level properties of to CompassQL. (They are probably less important than adding width and height, but given that you already have context about how to add them, maybe it's worth spending a little more time to add other properties.) -- but let's do that in a separate PR.

@kanitw
Copy link
Member

kanitw commented Nov 27, 2017

Don't forget to take care of "include" :)

@haldenl
Copy link
Contributor Author

haldenl commented Nov 28, 2017

Refactored for include!

Copy link
Member

@kanitw kanitw left a comment

Choose a reason for hiding this comment

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

The change looks good to me. In a future PR, you may want to rename SizeProp to TopLevelProp as we have other top-level properties. But I think this is fine for now.

Test is still failing though.

@haldenl
Copy link
Contributor Author

haldenl commented Nov 28, 2017

Okay sounds, good, would we want to include mark also as a 'Top Level Property'?

@kanitw
Copy link
Member

kanitw commented Nov 29, 2017

Okay sounds, good, would we want to include mark also as a 'Top Level Property'?

Um let's say no -- because mark can have nested properties and top-level properties in VL is applicable for single view and multi view (while mark is only for single view)

@kanitw
Copy link
Member

kanitw commented Nov 29, 2017

I think your latest commit which says "add test" haven't really add test. lol

@kanitw kanitw merged commit 0935ed7 into master Dec 6, 2017
@kanitw kanitw deleted the hl/width_height branch December 6, 2017 20:31
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.

None yet

2 participants