-
Notifications
You must be signed in to change notification settings - Fork 612
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: Init the better orient for the ranged bar #8475
Conversation
@@ -43,9 +43,9 @@ describe('Mark: Bar', () => { | |||
expect(props.height).toBeUndefined(); | |||
}); | |||
|
|||
it('should draw vertical bar, with y from zero to field value and bar with quantitative x, x2, and y', () => { | |||
const x: PositionFieldDef<string> = {field: 'bin_start', type: 'quantitative'}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are the test cases for the bin, I change this to cover not-binned cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tests are fine, but shouldn't you keep the old tests but add bin: 'binned' to it to cover the
if (isFieldDef(y) && isBinned(y.bin)) {
condition you modified above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at regressions and resolve unintended changes + revise the tests you removed.
@@ -43,9 +43,9 @@ describe('Mark: Bar', () => { | |||
expect(props.height).toBeUndefined(); | |||
}); | |||
|
|||
it('should draw vertical bar, with y from zero to field value and bar with quantitative x, x2, and y', () => { | |||
const x: PositionFieldDef<string> = {field: 'bin_start', type: 'quantitative'}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new tests are fine, but shouldn't you keep the old tests but add bin: 'binned' to it to cover the
if (isFieldDef(y) && isBinned(y.bin)) {
condition you modified above?
"y": {"scale": "y", "field": "residency_end"}, | ||
"y2": {"scale": "y", "field": "residency_start"} | ||
"yc": {"scale": "y", "field": "residency"}, | ||
"height": {"value": 5} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff seems wrong?
You may need to add bin: "binned" in the related VL spec.
"y": {"scale": "y", "field": "count"}, | ||
"y2": {"scale": "y", "value": 0} | ||
"yc": {"scale": "y", "field": "count"}, | ||
"height": {"value": 5} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff also seems wrong. You may need to add bin: "binned" in the related VL spec.
@@ -142,7 +142,7 @@ | |||
}, | |||
"x": {"scale": "x", "field": "year"}, | |||
"y": {"scale": "y", "field": "wages"}, | |||
"y2": {"scale": "y", "value": 0}, | |||
"y2": {"field": {"group": "height"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff seems wrong. Not sure why, please investigate / debug to prevent this regression.
a9d1dc5
to
9ae6cf3
Compare
@@ -48,7 +48,7 @@ | |||
"title": "Distribution of Frame Render Time (ms)", | |||
"width": {"step": 40}, | |||
"height": 100, | |||
"mark": {"type": "bar", "cornerRadiusEnd": 0}, | |||
"mark": {"type": "bar", "cornerRadiusEnd": 0, "orient": "vertical"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to add "binned" but failed due to #8476.
Adding "orient" is also an alternative way to make this spec work.
examples/specs/wheat_wages.vl.json
Outdated
@@ -74,7 +74,7 @@ | |||
{ "calculate": "((!datum.commonwealth && datum.index % 2) ? -1: 1) * 2 + 95", "as": "offset" }, | |||
{ "calculate": "95", "as": "y" } | |||
], | |||
"mark": {"type": "bar", "stroke": "#000"}, | |||
"mark": {"type": "bar", "stroke": "#000", "orient": "vertical"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has all of y, y2, x, x2, I think it should just be a rect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please try to see if changing bar to rect in wheat_wages works before merging.
examples/specs/wheat_wages.vl.json
Outdated
@@ -16,7 +16,7 @@ | |||
}, | |||
"layer": [ | |||
{ | |||
"mark": {"type": "bar", "fill": "#aaa", "stroke": "#999"}, | |||
"mark": {"type": "bar", "fill": "#aaa", "stroke": "#999", "orient": "vertical"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kanitw For this one, I will keep as "bar" but change to add "binned" on encoding.x instead of the "orient" since this spec has a kind of the bin transform implying it is binned.
9ae6cf3
to
ccc3007
Compare
🚀 PR was released in |
* Add example for ranged bar with not binned position channels * Change the init logic to assgin better orient for ranged bar
Update the init logic to assign the better orient for ranged bar charts. The new logic is the same as the area.
Before
After
📦 Published PR as canary version:
5.5.1--canary.8475.ccc3007.0
✨ Test out this PR locally via:
npm install vega-lite@5.5.1--canary.8475.ccc3007.0 # or yarn add vega-lite@5.5.1--canary.8475.ccc3007.0