vega
vega copied to clipboard
Looking for a simple example of a grid layout within a group mark
I saw this example from a while back: https://github.com/vega/vega/issues/895 and while it does still work, I am trying to apply the layout to only the children of a specific group which I cannot seem to get to work.
The docs for Layout currently say "When applied at the top-level of a specification or within a group mark, all immediate children group marks will be collected and positioned according to the layout specification."
My current attempt is the following:
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"padding": 5,
"autosize": "pad",
"marks": [
{
"type": "group",
"layout": {"padding": 10, "columns": 1, "align": "all"},
"marks": [
{
"type": "text",
"encode": {
"update": {
"x": {"value": 0},
"y": {"value": 0},
"text": {"value": "Title Block"}
}
}
},
{
"type": "text",
"encode": {
"update": {
"x": {"value": 0},
"y": {"value": 0},
"text": {"value": "Graph Block"}
}
}
}
]
}
]
}
Which just results in the text on top of each other:

@domoritz I think this can be closed as it is just a bad spec.

{
"$schema": "https://vega.github.io/schema/vega/v5.0.json",
"padding": 5,
"autosize": "pad",
"layout": {"padding": 10, "columns": 1, "align": "all"},
"marks": [
{
"type": "group",
"marks": [
{
"type": "text",
"encode": {
"update": {
"x": {"value": 0},
"y": {"value": 0},
"text": {"value": "Title Block"}
}
}
}
]
},
{
"type": "group",
"marks": [
{
"type": "text",
"encode": {
"update": {
"x": {"value": 0},
"y": {"value": 0},
"text": {"value": "Graph Block"}
}
}
}
]
}
]
}