0

I'm wanting to create a chart (I'm calling it a 3x3 subplot, but this may not be the correct name) in Deneb: for each categorical x and y value, I want a stacked bar chart of the project names. [Eventually, colors will be added from a z value, highlighting based on group or tier, etc.] I'm using this sample data

enter image description here

and the code below. Currently, the bars are layered rather than stacked. I think I need to incorporate this transformation (measure cnt = COUNT('Table'[name]))

  "transform": [
    {
      "stack": "cnt",
      "as": ["ymin", "ymax"],
      "groupby": ["x", "y"]
    }
  ]

but I'm not sure how/where to insert it into the code below.

{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "bar",
        "stroke": "black",
        "strokeWidth": 1,
        "tooltip": true
      }
    },
    {
      "mark": "text",
      "encoding": {
        "text": {
          "field": "Name",
          "type": "nominal"
        }
      }
    }
  ],
  "encoding": {
    "x": {
      "field": "x",
      "type": "nominal",
      "scale": {
        "domain": ["low", "med", "high"]
      },
      "axis": {
        "title": "X Level",
        "labelAngle": 0
      }
    },
    "y": {
      "field": "y",
      "type": "nominal",
      "scale": {
        "domain": ["high", "med", "low"]
      },
      "axis": {"title": "Y Level"}
    }
  }
}

To be clear, I'm aiming for this sort of chart where names have been removed. enter image description here

Davide Bacci
  • 16,647
  • 3
  • 10
  • 36
Pat
  • 125
  • 9

1 Answers1

0

See cross-posted question here

Pat
  • 125
  • 9