Search code examples
vega-lite

Tooltip Title , how to set the title as field value instead of hard coded value in vegalite charts


In Vegalite for tooltip, how to set data value as Title

When i set data field in the title it does not work, below is code snippet

"tooltip": [
  {

    "field" : "xToolTip",
    
    "title" : "xName"
    
  }

where xName is data attribute

Tooltip image


Solution

  • Just don't set a title at all and the title will be the name of the field in your dataset.