Labeling in vega lite

Hello,

i have this eureur when showing value in labels in side my horizantal bar .

this is my code :
"layer": [{
"mark": "bar"
}, {
"mark": {
"type": "text",
"align": "right",
"xOffset": -4,
"aria": false
},
"encoding": {
"text": {"field": "result", "type": "nominal"}
}
}]
vega
thank you for help .

@suibgui I'm not sure what the issue is you're trying to resolve. Do you want the labels in your horizontal bars not to show or is it the way they are showing up that's the problem?
If it's the way they are showing up and you want them to display to the right, try the following:

  1. Change "align":"right" to "align":"left"
  2. Add an "xOffset": <some positive value> where gives you enough space to render your longest string
  3. Change your encoding test type according to what you need as per the docs
    I tried these settings using the vega editor:

While we technically don't support using vega-lite but try to help where we can :smile: . I'm not a Vega expert but the docs are pretty good. Here's a quick link to the documentation for marks

1 Like

hi @cheiligers,

tha same problem,

thank you

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