-
-
Notifications
You must be signed in to change notification settings - Fork 633
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
feat: stack area, bar, and arc marks by default #7098
Conversation
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.
Fix test?
I noticed while edge-testing #7957 that there are a few conditions where stack transforms are not added for Both of these situations can be improved by adding
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{"segment": 1, "value": 8},
{"segment": 2, "value": 7},
{"segment": 3, "value": 6}
]
},
"mark": "arc",
"encoding": {
"theta": {"field": "segment", "type": "quantitative"},
"radius": {
"field": "segment",
"type": "quantitative"
}
}
} Output {
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "view",
"data": [
{
"name": "source_0",
"values": [
{"segment": 1, "value": 8},
{"segment": 2, "value": 7},
{"segment": 3, "value": 6}
]
},
{
"name": "data_0",
"source": "source_0",
"transform": [
{
"type": "filter",
"expr": "isValid(datum[\"segment\"]) && isFinite(+datum[\"segment\"])"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "arc",
"style": ["arc"],
"from": {"data": "data_0"},
"encode": {
"update": {
"fill": {"value": "#4c78a8"},
"description": {
"signal": "\"segment: \" + (format(datum[\"segment\"], \"\"))"
},
"x": {"signal": "width", "mult": 0.5},
"y": {"signal": "height", "mult": 0.5},
"outerRadius": {"scale": "radius", "field": "segment"},
"innerRadius": {"scale": "radius", "value": 0},
"startAngle": {"scale": "theta", "field": "segment"},
"endAngle": {"scale": "theta", "value": 0}
}
}
}
],
"scales": [
{
"name": "theta",
"type": "linear",
"domain": {"data": "data_0", "field": "segment"},
"range": [0, 6.283185307179586],
"zero": true
},
{
"name": "radius",
"type": "linear",
"domain": {"data": "data_0", "field": "segment"},
"range": [0, {"signal": "min(width,height)/2"}],
"zero": true
}
]
}
Input {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"values": [
{"segment": 1, "value": 8},
{"segment": 2, "value": 7},
{"segment": 3, "value": 6}
]
},
"mark": "arc",
"encoding": {
"theta": {"field": "value"},
"radius": {
"field": "segment"
}
}
} Output {
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 200,
"height": 200,
"style": "view",
"data": [
{
"name": "source_0",
"values": [
{"segment": 1, "value": 8},
{"segment": 2, "value": 7},
{"segment": 3, "value": 6}
]
}
],
"marks": [
{
"name": "marks",
"type": "arc",
"style": ["arc"],
"from": {"data": "source_0"},
"encode": {
"update": {
"fill": {"value": "#4c78a8"},
"description": {
"signal": "\"value: \" + (isValid(datum[\"value\"]) ? datum[\"value\"] : \"\"+datum[\"value\"]) + \"; segment: \" + (isValid(datum[\"segment\"]) ? datum[\"segment\"] : \"\"+datum[\"segment\"])"
},
"x": {"signal": "width", "mult": 0.5},
"y": {"signal": "height", "mult": 0.5},
"outerRadius": {"scale": "radius", "field": "segment"},
"innerRadius": {
"scale": "radius",
"field": "segment",
"offset": {"signal": "bandwidth('radius')"}
},
"startAngle": {"scale": "theta", "field": "value"},
"endAngle": {
"scale": "theta",
"field": "value",
"offset": {"signal": "bandwidth('theta')"}
}
}
}
}
],
"scales": [
{
"name": "theta",
"type": "band",
"domain": {"data": "source_0", "field": "value", "sort": true},
"range": [0, 6.283185307179586]
},
{
"name": "radius",
"type": "band",
"domain": {"data": "source_0", "field": "segment", "sort": true},
"range": [0, {"signal": "min(width,height)/2"}]
}
]
}
|
fixes #6864