vega icon indicating copy to clipboard operation
vega copied to clipboard

Looking for a simple example of a grid layout within a group mark

Open gurtajkhatra opened this issue 5 years ago • 1 comments

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: image

gurtajkhatra avatar Apr 12 '21 15:04 gurtajkhatra

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

image


{
  "$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"}
            }
          }
        }
      ]
    }
  ]
}

PBI-David avatar Aug 07 '22 11:08 PBI-David