SandDance icon indicating copy to clipboard operation
SandDance copied to clipboard

Vega tooltips do not work

Open Timmmm opened this issue 6 years ago • 2 comments

Simple example that works in the online Vega editor but not in the "vega spec transition" example:

{
  "$schema": "https://vega.github.io/schema/vega/v3.json",
  "width": 200,
  "height": 200,
  "data": [
    {
      "name": "table",
      "values": [
        {"x": 12, "y": 23},
        {"x": 22, "y": 3}
      ]
    }
  ],
  "scales": [
    {
      "name": "xscale",
      "type": "linear",
      "domain": {"data": "table", "field": "x"},
      "range": "width"
    },
    {
      "name": "yscale",
      "type": "linear",
      "domain": {"data": "table", "field": "y"},
      "range": "height"
    }
  ],
  "marks": [
    {
      "type": "rect",
      "from": {"data": "table"},
      "encode": {
        "enter": {
          "x": {"field": "x", "scale": "xscale"},
          "y": {"field": "y", "scale": "yscale"},
          "width": {"value": 30},
          "height": {"value": 30},
          "tooltip": {"signal": "datum.x"}
        },
        "update": {"fill": {"value": "#ccc"}},
        "hover": {"fill": {"value": "pink"}}
      }
    }
  ],
  "config": {}
}

How have you implemented tooltips in the SandDance explorer if they don't work in Vega? I was under the impression that it used Vega under the hood - is that not the case?

Also weirdly the hover fill is always black.

Timmmm avatar Nov 01 '19 14:11 Timmmm

Hi Tim, our renderer outputs the Vega scenegraph in a one-way fashion currently. To implement interactions, we would need to take a survey of what’s possible in Vega and compare that to what’s possible in deck.gl. This is work that hasn’t begun. Also consider that mouse coordinates etc won’t always translate if we are in 3D mode.

danmarshall avatar Nov 01 '19 15:11 danmarshall

btw, you can also run vega specs in Vega Viewer in vscode, with local data files loading, over 580 built-in vega and vega-lite json spec examples, etc. :)

https://marketplace.visualstudio.com/items?itemName=RandomFractalsInc.vscode-vega-viewer

RandomFractals avatar Nov 20 '19 14:11 RandomFractals