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.07k stars 1.02k forks source link

Ability to customize hovering label #48

Closed SammyIsra closed 6 years ago

SammyIsra commented 7 years ago

Hello! Is there currently a way to customize the label that shows in when one hovers over a section of a chart? For example, on the following Pie chart: image Say I want to display the number in a friendlier matter by formatting it the same way one formats the other labels (passing a string or a function that receives the node)

plouc commented 7 years ago

Unfortunately, it's not possible for now, but it's a feature I'm planing to add, because it's a "must have".

lapidus commented 6 years ago

Any updates on this one? Would be super nice to have a single tooltip per line and dot in the Line charts too. The 'stacked tooltip' becomes a bit bulky with 10+ lines. Can we help out somehow? 👍 Thanks for a fabulous library! :)

ahtohbi4 commented 6 years ago

@SammyIsra, it will be possible after releasing a new version with this PR. The feature already is available in the master branch for components Bar, Bubble, Chord, HeatMap, Line, Pie, Radar, Sankey and Stream.

If I understood your issue correctly. :sweat_smile:

SammyIsra commented 6 years ago

@ahtohbi4 it seems like that's exactly what I was asking for! It seems you guys have a React Storybook set. Is it public? I'd love to see how the custom tooltips look and work, if possible!

plouc commented 6 years ago

@SammyIsra, the storybook is available here: http://nivo.rocks/storybook/

plouc commented 6 years ago

You can now format tooltip using tooltipFormat property, you can see it in action here

ramytamer commented 6 years ago

@plouc I know I am little bit late to the party, but can't I access the index or the x value in the tooltipFormat function beside the value/y ?

riteshnus commented 6 years ago

@ramytamer did you find any hack to get the value x?

ramytamer commented 6 years ago

@riteshnus After a quick glance on the code it turns out that the tooltipFormat function is called with one argument (the y value).

I can work on a PR if @plouc would accept this feature.

riteshnus commented 6 years ago

@ramytamer Did you PR accepted? got any solution around it

RParvathi commented 5 years ago

Hi, Is there a way to customize tooltip and colors for ResponsiveSunburst ? Could you please share an example if available. Also, is there a Legend option for the Sunburst ?