plouc / nivo

nivo provides a rich set of dataviz components, built on top of the awesome d3 and React libraries
https://nivo.rocks
MIT License
13.17k stars 1.03k forks source link

Funnel support for legends & tooltips #1169

Closed onionhammer closed 3 years ago

onionhammer commented 4 years ago

The new funnel chart is great! However, before I can replace my Bars with it, I'm wondering if some feature parity is on the way, namely: are Legends and custom tooltips coming to Funnel?

Thanks!

wyze commented 4 years ago

Not currently in the pipeline for me, but I'd be happy to review PRs adding these features!

onionhammer commented 4 years ago

@wyze thanks, any estimate on the level of effort for someone coming in from this cold to add support for these features?

I'll consider digging into it when I get time if it's small enough

wyze commented 4 years ago

Should be pretty straight forward. Funnel is using the layers API, so you can add a new layer for the legends, and it needs an array based on the parts data, Array<{ id, color, label }>. Pass that to the BoxLegendSvg. You would do this in the useFunnel hook and return it. See the sankey example: https://github.com/plouc/nivo/blob/master/packages/sankey/src/hooks.js#L153-L161

Then for the tooltip, you have the Funnel accept a new prop of tooltip and default it to the PartTooltip component. Then pass that tooltip prop all the way into here: https://github.com/plouc/nivo/blob/master/packages/funnel/src/hooks.js#L179 and https://github.com/plouc/nivo/blob/master/packages/funnel/src/hooks.js#L190

onionhammer commented 4 years ago

@wyze thanks for advising on this. Hopefully someone else can pick it up, my client says they'd rather stick with the current use of a horizontal bar chart than have me spend time implementing these features so we can use this funnel chart.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] commented 3 years ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

onionhammer commented 2 years ago

It seems like tooltip support has come in some way, but for some reason while I see them with 0.74.0 on codesandbox, the same code in my app does not display tooltips;

Codesandbox https://codesandbox.io/s/boring-cdn-ncidj?file=/src/App.js

My App

"@nivo/bar": "^0.74.0",
"@nivo/core": "^0.74.0",
"@nivo/funnel": "^0.74.0",
"@nivo/line": "^0.74.0",
"@nivo/pie": "^0.74.0",

Version: image

Code: image

Even with the same data.. is there some attribute missing that 'turns on' tooltips?

onionhammer commented 2 years ago

Upgrading to 0.76 appears to have resolved this - although no option for customizing tooltips still