Skip to content

QA: Vega-Lite API Tooltip Not Showing in Framework #1394

Answered by Fil
jwilber asked this question in Q&A
Discussion options

You must be logged in to vote

Only the native tooltips are supported in observablehq:stdlib/vega-lite (cf. https://github.com/observablehq/framework/blob/main/src/client/stdlib/vega-lite.js).

To add vega-tooltip, you can do:

import * as vega from "npm:vega";
import * as vegaLite from "npm:vega-lite";
import * as vegaLiteApi from "npm:vega-lite-api";
import * as tooltip from "npm:vega-tooltip";
const vl = vegaLiteApi.register(vega, vegaLite, {
  init: (view) => {
    view.tooltip(new tooltip.Handler().call);

    // another suggestion from https://observablehq.com/@vega/vega-lite-api-v5#vl
    if (view.container()) view.container().style["overflow-x"] = "auto";
  }
});

See https://observablehq.observablehq.cloud/pangea…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jwilber
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1391 on May 24, 2024 07:50.