Vega Lite tooltip

I’m trying to use tool tips in vega lite, but I can’t get them to show up.
Is this not available in the Vega versions you have?

Hi @Lars_Andersson,

Could you include a screenshot of your block configuration? And any other relevant data?

Thanks!
Julia

{
  "width": {{block.width}},
  "height": {{block.height}},
  "autosize": {
    "type": "fit",
    "contains": "padding"
  },
  "config": {
    "axis": {
      "labelColor": "#888c95",
      "titleColor": "#888c95",
      "domain": false
    },
    "legend": {
      "labelColor": "#888c95",
      "titleColor": "#888c95"
    },
    "view": {
      "fill": "white",
      "stroke": "transparent"
    }
  },
"layer":[
  
  {
  "data": {
    "name": "time-series-0"
  },
  "mark": {"type": "line", "tooltip": true},
  "encoding": {
    "x": {
      "field": "time",
      "type": "temporal"
    },
    "y": {
      "field": "value",
      "type": "quantitative"
    }
      
  }}
  

  
  ,
      
  {
"data": {
        "values": 
          {"max": 88}
      },
  "mark": "rule",
   
   "encoding": {
          "y": {"field": "max", "type": "quantitative"},
        "color" : {"value":"red"}
        
  }
         }
   ,
      
  {
"data": {
         "values": 
          {"min": 72}
        
      },
  "mark": "rule",
   
   "encoding": {
          "y": {"field": "min", "type": "quantitative"},
        "color" : {"value":"red"}
        
  }
         }
  
  
]


}

Am I doing something wrong or is the Tooltip feature not supposed to work currently?
I would like to know soon, if I need to go another route.

Thanks

Hi Lars,

I messed with this for a good amount of time and believe you have some incorrect syntax in your configuration. I would recommend checking out the following articles:



See the last example on this page.

The following is an example from the Forums:

I would recommend checking out these resources, then, should you still not be successful, reading through Vega-Lite’s GitHub issues and opening one if you do not see it already.

Thanks!
Julia

So it has nothing to do with which Vega version I select?

I figured out what was wrong. If I switched to mark:“point” instead of “line”, they showed up.

Shouldn’t I be able to copy in the code shown at https://vega.github.io/vega-lite/examples/interactive_multi_line_tooltip.html

or is that not supposed to work?

Never mind I figured it out. coped over example csv to local file

1 Like