-
I am having trouble figuring out how to get a tooltip to render in framework using the Vega-Lite API (instead of the json spec). If I use the json spec, e.g. some vega-lite code with However, when I use the JavaScript API, no tooltip shows. Here's are two reproducible example showcasing my issue:
js-chunk:
div anchor:
I tried including an import from
Appreciate any input or help here! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Only the native tooltips are supported in To add 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/party/vega-lite-tooltips Maybe we should add this to the default build, though? |
Beta Was this translation helpful? Give feedback.
-
Thanks so much. "Maybe we should add this to the default build, though?" Not sure if it's worth adding to default, but I think it's worth adding to the Vega page in the documentation. If you go that route, I'm happy to submit a PR. |
Beta Was this translation helpful? Give feedback.
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:See https://observablehq.observablehq.cloud/pangea…