Forum Discussion

tomwill's avatar
tomwill
Icon for Microsoft Employee rankMicrosoft Employee
3 years ago
Solved

Deneb - change labelFontWeight for one value in an axis label

I have a text field ['Region'] with four values {Global, AMER, APAC, EMEA}. I have a simple bar chart and want the label to be bold only for 'Global'. I tried:   "encoding": { "y": { "fi...
  • dm-p's avatar
    3 years ago

    Hi tomwill,

    Fields are not exposed in the datum object for an axis label. You have access to either a label or value property in the backing datum and it's this that you need to inspect in your condition.

    Something like the following should work:

      "labelFontWeight": {
        "condition": {
          "test": "datum['value'] == 'Global'",
          "value": "bold"
        },
        "value": "normal"
      }

    I've replicated this in a chart I have open, specifying that the Wellington label be bold, as per the above approach and this seems as expected, e.g.:

    Regards,

    Daniel