-
Notifications
You must be signed in to change notification settings - Fork 590
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 joinaggregate. Fixes #4121 #4554
Changes from 10 commits
8545768
5aa2ef6
fcb9794
71ef581
a3d7057
b0a3590
371e353
090d5e8
4a682bd
7b7d4c6
0afc6cd
e13cefa
d37431c
79bf709
1010ecb
5fa4bda
610afa9
4b3d935
0489bc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples/specs/*.vl.json | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,10 @@ | |
"format": {"type": "json"}, | ||
"transform": [ | ||
{ | ||
"type": "window", | ||
"params": [null], | ||
"type": "joinaggregate", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cumulative frequency should not use join aggregate. Window with frame = There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ups, my mistake. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code should only do it when the frame is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a bug in the code. Fixed. |
||
"as": ["cumulative_count"], | ||
"ops": ["count"], | ||
"fields": ["count"], | ||
"sort": {"field": ["IMDB_Rating"], "order": ["ascending"]}, | ||
"frame": [null, 0] | ||
"fields": ["count"] | ||
} | ||
] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{ | ||
"$schema": "https://vega.github.io/schema/vega/v4.json", | ||
"description": "A bar graph showing what activites consume what percentage of the day.", | ||
"autosize": "pad", | ||
"padding": 5, | ||
"width": 200, | ||
"style": "cell", | ||
"data": [ | ||
{ | ||
"name": "source_0", | ||
"values": [ | ||
{"Activity": "Sleeping", "Time": 8}, | ||
{"Activity": "Eating", "Time": 2}, | ||
{"Activity": "TV", "Time": 4}, | ||
{"Activity": "Work", "Time": 8}, | ||
{"Activity": "Exercise", "Time": 2} | ||
] | ||
}, | ||
{ | ||
"name": "data_0", | ||
"source": "source_0", | ||
"transform": [ | ||
{ | ||
"type": "joinaggregate", | ||
"as": ["TotalTime"], | ||
"ops": ["sum"], | ||
"fields": ["Time"] | ||
}, | ||
{ | ||
"type": "formula", | ||
"expr": "datum.Time/datum.TotalTime * 100", | ||
"as": "PercentOfTotal" | ||
} | ||
] | ||
} | ||
], | ||
"signals": [ | ||
{"name": "y_step", "value": 12}, | ||
{ | ||
"name": "height", | ||
"update": "bandspace(domain('y').length, 0.1, 0.05) * y_step" | ||
} | ||
], | ||
"marks": [ | ||
{ | ||
"name": "marks", | ||
"type": "rect", | ||
"style": ["bar"], | ||
"from": {"data": "data_0"}, | ||
"encode": { | ||
"update": { | ||
"fill": [ | ||
{ | ||
"test": "datum[\"PercentOfTotal\"] === null || isNaN(datum[\"PercentOfTotal\"])", | ||
"value": null | ||
}, | ||
{"value": "#4c78a8"} | ||
], | ||
"tooltip": { | ||
"signal": "{\"% of total Time\": format(datum[\"PercentOfTotal\"], \"\"), \"Activity\": ''+datum[\"Activity\"]}" | ||
}, | ||
"x": {"scale": "x", "field": "PercentOfTotal"}, | ||
"x2": {"scale": "x", "value": 0}, | ||
"y": {"scale": "y", "field": "Activity"}, | ||
"height": {"scale": "y", "band": true} | ||
} | ||
} | ||
} | ||
], | ||
"scales": [ | ||
{ | ||
"name": "x", | ||
"type": "linear", | ||
"domain": {"data": "data_0", "field": "PercentOfTotal"}, | ||
"range": [0, {"signal": "width"}], | ||
"nice": true, | ||
"zero": true | ||
}, | ||
{ | ||
"name": "y", | ||
"type": "band", | ||
"domain": {"data": "data_0", "field": "Activity", "sort": true}, | ||
"range": {"step": {"signal": "y_step"}}, | ||
"paddingInner": 0.1, | ||
"paddingOuter": 0.05 | ||
} | ||
], | ||
"axes": [ | ||
{ | ||
"scale": "x", | ||
"orient": "bottom", | ||
"grid": false, | ||
"title": "% of total Time", | ||
"labelFlush": true, | ||
"labelOverlap": true, | ||
"tickCount": {"signal": "ceil(width/40)"}, | ||
"zindex": 1 | ||
}, | ||
{ | ||
"scale": "x", | ||
"orient": "bottom", | ||
"gridScale": "y", | ||
"grid": true, | ||
"tickCount": {"signal": "ceil(width/40)"}, | ||
"domain": false, | ||
"labels": false, | ||
"maxExtent": 0, | ||
"minExtent": 0, | ||
"ticks": false, | ||
"zindex": 0 | ||
}, | ||
{ | ||
"scale": "y", | ||
"orient": "left", | ||
"grid": false, | ||
"title": "Activity", | ||
"zindex": 1 | ||
} | ||
], | ||
"config": {"axisY": {"minExtent": 30}} | ||
} |
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.
Can we put this rule in
.prettierrc.json
?If we can, probably better to consolidate them in one place.
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.
I don't think it works yet. prettier/prettier#3460