Kibana Vega : Right Aligned Five Digit Padding

I am using Kibana vega visualization to show metrics. I would like to achieve the right align five-digit padding. What can be the property name to achieve the same?

My vega code :

marks: [
      type: text
      from: {data: "latestTotalBalance"}
      encode: {
        update: {
          text: {signal: "format(datum.totalUnitAmount, ',')"}
          align: {value: "center"}
          baseline: {value: "middle"}
          xc: {signal: "width/2"}
          yc: {signal: "height/2"}
          fontSize: {signal: "min(width/20, height)/1.3"}
          "fill": {"value": "white"}
          "fontWeight":{"value": "bold"}

The result with above code is :

Expected result :

Looks like format requires a d3 format specifier. I haven't tested this, but based on d3's docs I think something like this would do what you are looking for:

          text: {signal: "format(datum.totalUnitAmount, ',.5f')"}
1 Like

Awesome! :raised_hands: That worked. Thanks @lukeelmers

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.