Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-vega and react-vega tooltips

I'm using react-vega-lite.

In official examples:

https://vega.github.io/vega-lite/

https://vega.github.io/react-vega-lite/

https://vega.github.io/react-vega/

vega-lite (without react) has a tooltip by default react-vega allows to handle onSignalTooltip event.

So, I have 2 questions: 1) Is it possible to turn on tooltip with react-vega (react-vega-lite)? 2) Does react-vega-lite support onSignalTooltip or I need to switch to Vega?

like image 879
alexfrize Avatar asked Aug 05 '26 20:08

alexfrize


1 Answers

Add vega-tooltip package as a dependency, then import the Handler class from it and pass an instance through the tooltip parameter of the VegaLite component:

import { Handler } from 'vega-tooltip';

...

<VegaLite spec={spec} data={barData} tooltip={new Handler().call} />
like image 59
ag0rex Avatar answered Aug 08 '26 08:08

ag0rex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!