Skip to content

Commit

Permalink
chore: update examples [CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed Jun 28, 2023
1 parent b5c6eac commit aa2e494
Show file tree
Hide file tree
Showing 10 changed files with 543 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/bar_binned_yearmonth_grouped.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 158 additions & 0 deletions examples/compiled/bar_binned_yearmonth_grouped.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "Stock price over time.",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "cell",
"data": [
{
"name": "source_0",
"url": "data/stocks.csv",
"format": {"type": "csv", "parse": {"date": "date"}},
"transform": [
{
"type": "filter",
"expr": "inrange(time(datum[\"date\"]), [time(datetime(2005, 0, 1, 0, 0, 0, 0)), time(datetime(2005, 2, 1, 0, 0, 0, 0))])"
},
{
"type": "formula",
"expr": "timeOffset('month', datum['date'], 1)",
"as": "date_end"
},
{
"type": "stack",
"groupby": ["date", "symbol"],
"field": "price",
"sort": {"field": [], "order": []},
"as": ["price_start", "price_end"],
"offset": "zero"
},
{
"type": "filter",
"expr": "(isDate(datum[\"date\"]) || (isValid(datum[\"date\"]) && isFinite(+datum[\"date\"]))) && isValid(datum[\"price\"]) && isFinite(+datum[\"price\"])"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "rect",
"style": ["bar"],
"from": {"data": "source_0"},
"encode": {
"update": {
"fill": {"scale": "color", "field": "symbol"},
"ariaRoleDescription": {"value": "bar"},
"description": {
"signal": "\"date: \" + (timeFormat(datum[\"date\"], timeUnitSpecifier([\"year\",\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; price: \" + (format(datum[\"price\"], \"\")) + \"; symbol: \" + (isValid(datum[\"symbol\"]) ? datum[\"symbol\"] : \"\"+datum[\"symbol\"])"
},
"xc": {
"scale": "x",
"field": "date",
"offset": {"scale": "xOffset", "field": "symbol", "band": 0.5}
},
"width": {"signal": "max(0.25, bandwidth('xOffset'))"},
"y": {"scale": "y", "field": "price_end"},
"y2": {"scale": "y", "field": "price_start"}
}
}
}
],
"scales": [
{
"name": "x",
"type": "time",
"domain": {"data": "source_0", "fields": ["date", "date_end"]},
"range": [0, {"signal": "width"}]
},
{
"name": "y",
"type": "linear",
"domain": {"data": "source_0", "fields": ["price_start", "price_end"]},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
},
{
"name": "xOffset",
"type": "band",
"domain": {"data": "source_0", "field": "symbol", "sort": true},
"range": [
{
"signal": "0.1 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
},
{
"signal": "0.9 * (scale('x', datetime(2001, 1, 1, 0, 0, 0, 0)) - scale('x', datetime(2001, 0, 1, 0, 0, 0, 0)))"
}
]
},
{
"name": "color",
"type": "ordinal",
"domain": {"data": "source_0", "field": "symbol", "sort": true},
"range": "category"
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"tickMinStep": {
"signal": "datetime(2001, 1, 1, 0, 0, 0, 0) - datetime(2001, 0, 1, 0, 0, 0, 0)"
},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"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",
"format": {
"signal": "timeUnitSpecifier([\"year\",\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})"
},
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"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": "price",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
],
"legends": [{"fill": "color", "symbolType": "square", "title": "symbol"}]
}
Binary file added examples/compiled/bar_binned_yearmonth_label.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit aa2e494

Please sign in to comment.