btmills / react-datamaps

React component for D3 DataMaps
MIT License
31 stars 22 forks source link

No popupTemplate on arcConfig #13

Open dheiahmari opened 7 years ago

dheiahmari commented 7 years ago

I'm currently using react-datamaps v0.3.0 and it's perfect for what I need but then I tried arcConfig.popupTemplate but can't seem to make it work. The 'popupTemplate' function returns a plain string. I tested it on bubblesConfig and it works fine. Is this still unsupported or am I doing something wrong?

Here's my code:

<Datamap bubbles={this.state.bubbles} bubblesConfig={{ popupTemplate: bubblePopupTemplate }} arc={this.state.arcs} arcConfig={{ popupTemplate: arcPopupTemplate }} />

const bubblePopupTemplate = function(geo, data) { return 'hello'; };

const arcPopupTemplate = function(geo, data) { return 'hi'; };

Thanks in advance for your awesome work! 😄

btmills commented 6 years ago

Apologies for the delay in looking at this 😥

The bubbles example returns the string wrapped in <div class="hoverinfo">...</div>, which I think datamaps uses to generate HTML for the box. What happens if you do that?

At some point #3 ought to make popups a lot easier.

riteshnus commented 6 years ago

@btmills i am using the Arc datamap. So is it possible to add the popUpTemplate in arc datamap.