-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push group clipping down, support rounded rectangle example
- Loading branch information
Showing
18 changed files
with
2,158 additions
and
41 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,903 changes: 1,903 additions & 0 deletions
1,903
avenger-vega-test-data/vega-scenegraphs/clip/bar_rounded.sg.json
Large diffs are not rendered by default.
Oops, something went wrong.
179 changes: 179 additions & 0 deletions
179
avenger-vega-test-data/vega-specs/clip/bar_rounded.vg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
{ | ||
"$schema": "https://vega.github.io/schema/vega/v5.json", | ||
"background": "white", | ||
"padding": 5, | ||
"height": 200, | ||
"style": "cell", | ||
"data": [ | ||
{ | ||
"name": "source_0", | ||
"url": "data/seattle-weather.csv", | ||
"format": {"type": "csv", "parse": {"date": "date"}}, | ||
"transform": [ | ||
{ | ||
"field": "date", | ||
"type": "timeunit", | ||
"units": ["month"], | ||
"as": ["month_date", "month_date_end"] | ||
}, | ||
{ | ||
"type": "aggregate", | ||
"groupby": ["month_date", "weather"], | ||
"ops": ["count"], | ||
"fields": [null], | ||
"as": ["__count"] | ||
}, | ||
{ | ||
"type": "stack", | ||
"groupby": ["month_date"], | ||
"field": "__count", | ||
"sort": {"field": ["weather"], "order": ["descending"]}, | ||
"as": ["__count_start", "__count_end"], | ||
"offset": "zero" | ||
} | ||
] | ||
} | ||
], | ||
"signals": [ | ||
{"name": "x_step", "value": 20}, | ||
{ | ||
"name": "width", | ||
"update": "bandspace(domain('x').length, 0.1, 0.05) * x_step" | ||
} | ||
], | ||
"marks": [ | ||
{ | ||
"type": "group", | ||
"from": { | ||
"facet": { | ||
"data": "source_0", | ||
"name": "stack_group_main", | ||
"groupby": ["month_date", "month_date_end"], | ||
"aggregate": { | ||
"fields": [ | ||
"__count_start", | ||
"__count_start", | ||
"__count_end", | ||
"__count_end" | ||
], | ||
"ops": ["min", "max", "min", "max"] | ||
} | ||
} | ||
}, | ||
"encode": { | ||
"update": { | ||
"x": {"scale": "x", "field": "month_date"}, | ||
"width": {"signal": "max(0.25, bandwidth('x'))"}, | ||
"y": { | ||
"signal": "min(scale('y',datum[\"min___count_start\"]),scale('y',datum[\"max___count_start\"]),scale('y',datum[\"min___count_end\"]),scale('y',datum[\"max___count_end\"]))" | ||
}, | ||
"y2": { | ||
"signal": "max(scale('y',datum[\"min___count_start\"]),scale('y',datum[\"max___count_start\"]),scale('y',datum[\"min___count_end\"]),scale('y',datum[\"max___count_end\"]))" | ||
}, | ||
"clip": {"value": true}, | ||
"cornerRadiusTopLeft": {"value": 10}, | ||
"cornerRadiusTopRight": {"value": 5} | ||
} | ||
}, | ||
"marks": [ | ||
{ | ||
"type": "group", | ||
"encode": { | ||
"update": { | ||
"y": {"field": {"group": "y"}, "mult": -1}, | ||
"width": {"field": {"group": "width"}} | ||
} | ||
}, | ||
"marks": [ | ||
{ | ||
"name": "marks", | ||
"type": "rect", | ||
"style": ["bar"], | ||
"from": {"data": "stack_group_main"}, | ||
"encode": { | ||
"update": { | ||
"fill": {"scale": "color", "field": "weather"}, | ||
"ariaRoleDescription": {"value": "bar"}, | ||
"description": { | ||
"signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; weather: \" + (isValid(datum[\"weather\"]) ? datum[\"weather\"] : \"\"+datum[\"weather\"])" | ||
}, | ||
"width": {"field": {"group": "width"}}, | ||
"y": {"scale": "y", "field": "__count_end"}, | ||
"y2": {"scale": "y", "field": "__count_start"} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"scales": [ | ||
{ | ||
"name": "x", | ||
"type": "band", | ||
"domain": {"data": "source_0", "field": "month_date", "sort": true}, | ||
"range": {"step": {"signal": "x_step"}}, | ||
"paddingInner": 0.1, | ||
"paddingOuter": 0.05 | ||
}, | ||
{ | ||
"name": "y", | ||
"type": "linear", | ||
"domain": { | ||
"data": "source_0", | ||
"fields": ["__count_start", "__count_end"] | ||
}, | ||
"range": [{"signal": "height"}, 0], | ||
"nice": true, | ||
"zero": true | ||
}, | ||
{ | ||
"name": "color", | ||
"type": "ordinal", | ||
"domain": {"data": "source_0", "field": "weather", "sort": true}, | ||
"range": "category" | ||
} | ||
], | ||
"axes": [ | ||
{ | ||
"scale": "y", | ||
"orient": "left", | ||
"gridScale": "x", | ||
"grid": true, | ||
"tickCount": {"signal": "ceil(height/40)"}, | ||
"domain": false, | ||
"labels": false, | ||
"aria": false, | ||
"maxExtent": 0, | ||
"minExtent": 0, | ||
"ticks": false, | ||
"zindex": 0 | ||
}, | ||
{ | ||
"scale": "x", | ||
"orient": "bottom", | ||
"grid": false, | ||
"title": "date (month)", | ||
"format": { | ||
"signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" | ||
}, | ||
"formatType": "time", | ||
"labelOverlap": true, | ||
"tickMinStep": { | ||
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)" | ||
}, | ||
"zindex": 0 | ||
}, | ||
{ | ||
"scale": "y", | ||
"orient": "left", | ||
"grid": false, | ||
"title": "Count of Records", | ||
"labelOverlap": true, | ||
"tickCount": {"signal": "ceil(height/40)"}, | ||
"zindex": 0 | ||
} | ||
], | ||
"legends": [{"fill": "color", "symbolType": "square", "title": "weather"}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.