Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update examples [CI] fix test chore: update examples [CI] add sort to example
- Loading branch information
1 parent
c03b7dc
commit acef6f1
Showing
6 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,80 @@ | ||
{ | ||
"$schema": "https://vega.github.io/schema/vega/v5.json", | ||
"description": "A simple pie chart with embedded data.", | ||
"background": "white", | ||
"padding": 5, | ||
"width": 200, | ||
"height": 200, | ||
"data": [ | ||
{ | ||
"name": "source_0", | ||
"values": [ | ||
{"category": 1, "value": 4}, | ||
{"category": 2, "value": 6}, | ||
{"category": 3, "value": 10}, | ||
{"category": 4, "value": 3}, | ||
{"category": 5, "value": 7}, | ||
{"category": 6, "value": 8} | ||
] | ||
}, | ||
{ | ||
"name": "data_0", | ||
"source": "source_0", | ||
"transform": [ | ||
{ | ||
"type": "stack", | ||
"groupby": [], | ||
"field": "value", | ||
"sort": {"field": ["category"], "order": ["ascending"]}, | ||
"as": ["value_start", "value_end"], | ||
"offset": "zero" | ||
}, | ||
{ | ||
"type": "filter", | ||
"expr": "isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])" | ||
} | ||
] | ||
} | ||
], | ||
"marks": [ | ||
{ | ||
"name": "marks", | ||
"type": "arc", | ||
"style": ["arc"], | ||
"from": {"data": "data_0"}, | ||
"encode": { | ||
"update": { | ||
"fill": {"scale": "color", "field": "category"}, | ||
"description": { | ||
"signal": "\"value: \" + (format(datum[\"value\"], \"\")) + \"; category: \" + (isValid(datum[\"category\"]) ? datum[\"category\"] : \"\"+datum[\"category\"])" | ||
}, | ||
"x": {"signal": "width", "mult": 0.5}, | ||
"y": {"signal": "height", "mult": 0.5}, | ||
"outerRadius": {"signal": "min(width,height)/2"}, | ||
"innerRadius": {"value": 0}, | ||
"startAngle": {"scale": "theta", "field": "value_end"}, | ||
"endAngle": {"scale": "theta", "field": "value_start"} | ||
} | ||
} | ||
} | ||
], | ||
"scales": [ | ||
{ | ||
"name": "theta", | ||
"type": "linear", | ||
"domain": {"data": "data_0", "fields": ["value_start", "value_end"]}, | ||
"range": [0, 6.283185307179586], | ||
"zero": true | ||
}, | ||
{ | ||
"name": "color", | ||
"type": "ordinal", | ||
"domain": { | ||
"fields": [[5, 6], {"data": "data_0", "field": "category"}], | ||
"sort": true | ||
}, | ||
"range": ["purple", "green", "blue", "yellow", "magenta", "brown"] | ||
} | ||
], | ||
"legends": [{"fill": "color", "symbolType": "circle", "title": "category"}] | ||
} |
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 |
---|---|---|
|
@@ -53,7 +53,8 @@ | |
6 | ||
] | ||
} | ||
} | ||
}, | ||
"sort": null | ||
} | ||
} | ||
} |
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