react-vega and react-vega tooltips

主宰稳场 提交于 2020-01-15 04:52:05

问题


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?


回答1:


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} />


来源:https://stackoverflow.com/questions/53642760/react-vega-and-react-vega-tooltips

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!