Search code examples
vega-litevega

Why is my vega-lite tooltip attached to a rule so slow


I have this vega-lite chart (based on the seattle-weather data).

It includes a vertical "rule" mark that moves on hover, and has a tooltip attached to it. I find that the rule feels very sluggish in following the mouse, and I think it's because it's trying to determine when the mouse stops moving.

Does anyone have ideas on why this actually happens and anything I can do to mitigate it?


Solution

  • You have a lot of datapoints on that x-axis. VL is highlighting each in turn and it takes time for it to catch up. Have a play with the throttle and debounce settings and consider disabling nearest. e.g.

    Editor

    https://vega.github.io/vega/docs/event-streams/

     "params": [
            {
              "name": "hover",
              "select": {
                "fields": ["date"],
                "on": {"type": "mouseover", "debounce": 0},
                "type": "point"
              }
            }
          ],