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 authored and kanitw committed Mar 25, 2020
1 parent 7ee0905 commit 2eff95e
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 41 deletions.
38 changes: 7 additions & 31 deletions examples/compiled/layer_bar_annotations.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
{"Day": 15, "Value": 130.5}
]
},
{
"name": "source_1",
"values": [{"ThresholdValue": 300, "Threshold": "hazardous"}]
},
{"name": "source_1", "values": [{}]},
{
"name": "data_1",
"source": "source_0",
Expand All @@ -51,26 +48,6 @@
"expr": "isValid(datum[\"baseline\"]) && isFinite(+datum[\"baseline\"])"
}
]
},
{
"name": "data_4",
"source": "source_1",
"transform": [
{
"type": "filter",
"expr": "isValid(datum[\"ThresholdValue\"]) && isFinite(+datum[\"ThresholdValue\"])"
}
]
},
{
"name": "data_5",
"source": "source_1",
"transform": [
{
"type": "filter",
"expr": "isValid(datum[\"ThresholdValue\"]) && isFinite(+datum[\"ThresholdValue\"])"
}
]
}
],
"signals": [
Expand Down Expand Up @@ -115,31 +92,31 @@
"name": "layer_1_layer_0_marks",
"type": "rule",
"style": ["rule"],
"from": {"data": "data_4"},
"from": {"data": "source_1"},
"encode": {
"update": {
"stroke": {"value": "black"},
"x": {"field": {"group": "width"}},
"x2": {"value": 0},
"y": {"scale": "y", "field": "ThresholdValue"}
"y": {"scale": "y", "value": 300}
}
}
},
{
"name": "layer_1_layer_1_marks",
"type": "text",
"style": ["text"],
"from": {"data": "data_5"},
"from": {"data": "source_1"},
"encode": {
"update": {
"align": {"value": "right"},
"baseline": {"value": "bottom"},
"text": {"value": "hazardous"},
"dx": {"value": -2},
"dy": {"value": -2},
"fill": {"value": "black"},
"x": {"field": {"group": "width"}},
"y": {"scale": "y", "field": "ThresholdValue"},
"text": {"signal": "''+datum[\"Threshold\"]"}
"y": {"scale": "y", "value": 300}
}
}
}
Expand Down Expand Up @@ -167,8 +144,7 @@
{"data": "data_1", "field": "Value"},
{"data": "data_2", "field": "baseline"},
{"data": "data_2", "field": "Value"},
{"data": "data_4", "field": "ThresholdValue"},
{"data": "data_5", "field": "ThresholdValue"}
[300]
]
},
"range": [{"signal": "height"}, 0],
Expand Down
1 change: 1 addition & 0 deletions examples/compiled/layer_line_datum_rule.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 140 additions & 0 deletions examples/compiled/layer_line_datum_rule.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "cell",
"data": [
{
"name": "source_0",
"url": "data/stocks.csv",
"format": {"type": "csv", "parse": {"date": "date"}}
},
{"name": "source_1", "values": [{}]}
],
"marks": [
{
"name": "layer_0_pathgroup",
"type": "group",
"from": {
"facet": {
"name": "faceted_path_layer_0_main",
"data": "source_0",
"groupby": ["symbol"]
}
},
"encode": {
"update": {
"width": {"field": {"group": "width"}},
"height": {"field": {"group": "height"}}
}
},
"marks": [
{
"name": "layer_0_marks",
"type": "line",
"style": ["line"],
"sort": {"field": "datum[\"date\"]"},
"from": {"data": "faceted_path_layer_0_main"},
"encode": {
"update": {
"stroke": {"scale": "color", "field": "symbol"},
"x": {"scale": "x", "field": "date"},
"y": {"scale": "y", "field": "price"},
"defined": {
"signal": "isValid(datum[\"date\"]) && isFinite(+datum[\"date\"]) && isValid(datum[\"price\"]) && isFinite(+datum[\"price\"])"
}
}
}
}
]
},
{
"name": "layer_1_marks",
"type": "rule",
"style": ["rule"],
"from": {"data": "source_1"},
"encode": {
"update": {
"strokeDash": {"value": [2, 2]},
"stroke": {"value": "black"},
"x": {"field": {"group": "width"}},
"x2": {"value": 0},
"y": {"scale": "y", "value": 300},
"strokeWidth": {"value": 2}
}
}
}
],
"scales": [
{
"name": "x",
"type": "time",
"domain": {"data": "source_0", "field": "date"},
"range": [0, {"signal": "width"}]
},
{
"name": "y",
"type": "linear",
"domain": {"fields": [{"data": "source_0", "field": "price"}, [300]]},
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
},
{
"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)"},
"domain": false,
"labels": 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,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"title": "date",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "price",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
],
"legends": [{"stroke": "color", "symbolType": "stroke", "title": "symbol"}]
}
2 changes: 1 addition & 1 deletion examples/compiled/repeat_layer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions examples/compiled/repeat_layer.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"from": {"data": "source_0"},
"encode": {
"update": {
"stroke": {"value": "#4c78a8"},
"stroke": {"scale": "color", "value": "US_Gross"},
"x": {
"signal": "scale(\"x\", 0.5 * datum[\"bin_maxbins_10_IMDB_Rating\"] + 0.5 * datum[\"bin_maxbins_10_IMDB_Rating_end\"])"
},
Expand All @@ -70,7 +70,7 @@
"from": {"data": "source_0"},
"encode": {
"update": {
"stroke": {"value": "#4c78a8"},
"stroke": {"scale": "color", "value": "Worldwide_Gross"},
"x": {
"signal": "scale(\"x\", 0.5 * datum[\"bin_maxbins_10_IMDB_Rating\"] + 0.5 * datum[\"bin_maxbins_10_IMDB_Rating_end\"])"
},
Expand Down Expand Up @@ -105,6 +105,12 @@
"range": [{"signal": "height"}, 0],
"nice": true,
"zero": true
},
{
"name": "color",
"type": "ordinal",
"domain": {"fields": [["US_Gross"], ["Worldwide_Gross"]]},
"range": "category"
}
],
"axes": [
Expand Down Expand Up @@ -135,10 +141,11 @@
"scale": "y",
"orient": "left",
"grid": false,
"title": "Mean of US_Gross, Mean of Worldwide_Gross",
"title": "Mean of US and Worldwide Gross",
"labelOverlap": true,
"tickCount": {"signal": "ceil(height/40)"},
"zindex": 0
}
]
],
"legends": [{"stroke": "color", "symbolType": "stroke"}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
"mark": "square",
"encoding": {
"longitude": {"value": -122.335167},
"longitude": {"datum": -122.335167},
"latitude": {"field": "latitude", "type": "quantitative"},
"size": {"value": 1},
"color": {"value": "steelblue"}
Expand All @@ -28,7 +28,7 @@
"mark": "square",
"encoding": {
"longitude": {"field": "longitude", "type": "quantitative"},
"latitude": {"value": 47.608013},
"latitude": {"datum": 47.608013},
"size": {"value": 1},
"color": {"value": "firebrick"}
},
Expand Down
71 changes: 71 additions & 0 deletions examples/specs/normalized/layer_bar_annotations_normalized.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "The PM2.5 value of Beijing observed 15 days, highlighting the days when PM2.5 level is hazardous to human health. Data source https://chartaccent.github.io/chartaccent.html",
"layer": [
{
"data": {
"values": [
{"Day": 1, "Value": 54.8},
{"Day": 2, "Value": 112.1},
{"Day": 3, "Value": 63.6},
{"Day": 4, "Value": 37.6},
{"Day": 5, "Value": 79.7},
{"Day": 6, "Value": 137.9},
{"Day": 7, "Value": 120.1},
{"Day": 8, "Value": 103.3},
{"Day": 9, "Value": 394.8},
{"Day": 10, "Value": 199.5},
{"Day": 11, "Value": 72.3},
{"Day": 12, "Value": 51.1},
{"Day": 13, "Value": 112},
{"Day": 14, "Value": 174.5},
{"Day": 15, "Value": 130.5}
]
},
"layer": [
{
"mark": "bar",
"encoding": {
"x": {"field": "Day", "type": "ordinal", "axis": {"labelAngle": 0}},
"y": {"field": "Value", "type": "quantitative"}
}
},
{
"mark": "bar",
"transform": [
{"filter": "datum.Value >= 300"},
{"calculate": "300", "as": "baseline"}
],
"encoding": {
"x": {"field": "Day", "type": "ordinal"},
"y": {
"field": "baseline",
"type": "quantitative",
"title": "PM2.5 Value"
},
"y2": {"field": "Value"},
"color": {"value": "#e45755"}
}
}
]
},
{
"data": {"values": [{}]},
"layer": [
{"mark": "rule", "encoding": {"y": {"datum": 300}}},
{
"mark": {
"type": "text",
"align": "right",
"baseline": "bottom",
"dx": -2,
"dy": -2,
"x": "width",
"text": "hazardous"
},
"encoding": {"y": {"datum": 300}}
}
]
}
]
}
14 changes: 11 additions & 3 deletions examples/specs/normalized/repeat_layer_normalized.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
"mark": "line",
"encoding": {
"x": {"bin": true, "field": "IMDB_Rating", "type": "quantitative"},
"y": {"aggregate": "mean", "field": "US_Gross", "type": "quantitative"}
"y": {
"aggregate": "mean",
"field": "US_Gross",
"type": "quantitative",
"title": "Mean of US and Worldwide Gross"
},
"color": {"datum": "US_Gross", "type": "nominal"}
},
"name": "child__layer_US_Gross"
},
Expand All @@ -17,8 +23,10 @@
"y": {
"aggregate": "mean",
"field": "Worldwide_Gross",
"type": "quantitative"
}
"type": "quantitative",
"title": "Mean of US and Worldwide Gross"
},
"color": {"datum": "Worldwide_Gross", "type": "nominal"}
},
"name": "child__layer_Worldwide_Gross"
}
Expand Down

0 comments on commit 2eff95e

Please sign in to comment.