vega-lite

Deneb (Vega-lite) - Dynamic height step


I created a horizontal bar chart using Deneb (Vega-lite) whose height has a step property. According to the documentation, the step accepts a number for type. My question is, is there a way to pass in a dynamic number?

For example, if the RowCount < 10, then step is 35, if RowCount > 10, then step is 20.

    {
  "data": {
    "name": "dataset"
  },
  "transform": [
    {
      "calculate": "length(data('dataset'))",
      "as": "RowCount"
    }
  ],
  "height": {"step": 20},
  "encoding": {
    "x": {
      "field": "Count_Account",
      "type":"quantitative"
    },
    "y": {
      "field": "Opportunity Description",
      "type": "nominal"
    }
  },
  "layer": [
    {
      "mark": {
        "type": "bar"
      }
    }
  ]
}

The power bi file can be downloaded at https://github.com/triCNguyen5/Test/blob/main/deneb_step.pbix


Solution

  • I have added a request on github deneb for this functionality: Please follow the status there. This is possible with javascript though.

    https://github.com/deneb-viz/deneb/issues/524