[Deneb Question] Messed alignment

In the following code, the text mark refers to the orange ticks. Why isn’t it following the alignment correctly? For each tick, the distance beetween the text and the tick is different.

image

I tried copying the code into another pbix but it was all messed up, don’t know why, so I hope the code is enough =)

Code
{
  "data": {"name": "dataset"},
  "layer": [
    {
      "mark": {
        "type": "bar",
        "opacity": 0.3,
        "tooltip": true
      },
      "encoding": {
        "x": {"field": "Faturamento", "axis": null}
      }
    },
    
    {
      "mark": {
        "type": "bar",
        "tooltip": true,
        "color": {
      "x1": 0,
      "x2": 1,
      "y1": 0,
      "y2": 0,
      "gradient": "linear",
      "stops": [
        {
          "offset": 0,
          "color": "rgba(76, 122, 42, 0.8)"
        },
        
        
        
        {
          "offset": 1,
          "color": "rgba(218, 227, 212, 1)"
        }
      ]
    }
      },
      "encoding": {
        "x": {
          "field": "Faturamento__highlight"
        },
        "opacity": {
          "condition": {
            "test": {
              "field": "__selected__",
              "equal": "off"
            },
            "value": 0
          },
          "value": 1
        }
      }
    },
    {
      "mark": {"type": "tick", "tooltip": true, "color": "orange", "thickness": 3, "height": 25},
      "encoding": {"x": {"field": "Tons SOP"}}
    },
    
    {"mark": {"type": "text", "fontSize": 11, "fontWeight": 500, "align": "left", "dx": -25},
      "encoding": {"text": {"field": "Tons SOP", "type": "quantitative", "format": ".2f"}
    }}
  ],
  
  "encoding": {
    "y": {
      "field": "Centro Regiao",
      "type": "nominal",
      "title": null,
      "axis": {"labelColor": "white"},
      "sort": "Faturamento"
    },
    "x": {
      "type": "quantitative",
      "axis": {"title": "Faturamento"}
    }
  }
}

Looks like you haven’t included “x” encoding for the text mark.
Greg

Oh, do we actually need it?
Before replying here, I tried some things and looked at the documentation, but didn’t find encoding “x” for text marks.

Would you please tell me how it would be on that code and/or give examples?

Thank you,
Claudio

Use the same x encoding as the tick mark above it.
Greg

1 Like