{ "height": 400, "data": { "url": "https://vega.github.io/vega-lite/data/stocks.csv", "format": { "parse": { "date": "date" } } }, "width": 800, "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "layer": [ { "layer": [ { "mark": "line" }, { "mark": "point", "selection": { "myTooltip": { "nearest": true, "empty": "none", "encodings": [ "x" ], "type": "single", "on": "mouseover" } }, "encoding": { "opacity": { "value": 0, "condition": { "value": 1, "selection": "myTooltip" } } } } ], "encoding": { "color": { "field": "symbol", "type": "nominal" }, "x": { "field": "date", "type": "temporal" }, "y": { "field": "price", "type": "quantitative" } } }, { "transform": [ { "filter": { "selection": "myTooltip" } } ], "layer": [ { "mark": { "color": "gray", "type": "rule" }, "encoding": { "x": { "field": "date", "type": "temporal" } } }, { "mark": { "dx": 5, "dy": -5, "align": "left", "type": "text" }, "encoding": { "color": { "field": "symbol", "type": "nominal" }, "text": { "field": "price", "type": "quantitative" }, "x": { "field": "date", "type": "temporal" }, "y": { "field": "price", "type": "quantitative" } } } ] } ], "description": "Displays tooltips for all stock prices of the hovered time" }