Fixed axis width and truncated labels in Deneb

Published Categorized as Deneb No Comments on Fixed axis width and truncated labels in Deneb

I recently had a requirement to fix the width of the Y-Axis and Y-Axis labels for two separate charts.

For one chart, the axis width would adjust when sliced based on the length of the longest axis label. For the other chart the category labels were simply too long and needed to be truncated.

To fix the axis labels, I set the label limit and the min and max extent :

  "encoding": {
    "y": {
      "field": "Label",
      "type": "nominal",
                    "axis": {
                "domain": false,
                "ticks": false,
                "labels": true,
                "labelAngle": 0,
                "labelPadding": 5,
                "titlePadding": 15,
                "labelColor": "black",
                "titleColor": "black",
                "title": "Features →",
                "titleY": 160,
                "titleAlign": "left",
                "labelLimit": 100,
                "minExtent": 100,
                "maxExtent": 100
              }
    }
},

Leave a comment

Your email address will not be published. Required fields are marked *