Skip to content

[Request] Allow customdata attribute to be accessed by hovertemplate using sankey, #4243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mtwichan opened this issue Oct 2, 2019 · 6 comments · Fixed by #4621
Closed
Milestone

Comments

@mtwichan
Copy link
Contributor

mtwichan commented Oct 2, 2019

I am/was giving a workshop to an enterprise customer where they want the ability/flexibility to be able to pass in multiple sets of external metadata to customdata, that can be than used by hovertemplate for the sankey graph.

We tried using customdata from the top level data property, but were not able to access it. Currently hovertemplate can only access whatever is within it's scope, e.g node or link. And, it can only take in one data set (list data structure). This could be helpful for other graph types as well.

CC: @alb-erandelcastillo

@etpinard
Copy link
Contributor

etpinard commented Oct 2, 2019

Right, the problem here is: should we assume customdata to have length of node.label or of link.value / link.source? In brief, customdata for sankey traces does not match 1:1 with the other data arrays.

So perhaps, we could expose two customdata attributes: one inside the node container and one inside the link container - similar to how we currently expose node.hovertemplate and link.hovertemplate.


This ticket is essentially equivalent to #2504

@antoinerg
Copy link
Contributor

So perhaps, we could expose two customdata attributes: one inside the node container and one inside the link container - similar to how we currently expose node.hovertemplate and link.hovertemplate.

This proposal makes a whole lot of sense. 👍

@chriddyp chriddyp added this to the Dash milestone Nov 25, 2019
@emmanuelle
Copy link
Contributor

Can you confirm that it is not possible to iterate through the customdata from a sankey.node? I'm trying to do this with @matthewchan15, for example in https://codepen.io/emmanuelle-plotly/pen/PoqOWPE?editors=1010 if I put fullData.customdata in the hovertemplate I get the whole array, and if I put fullData.customdata[0] I only get the first element but for all nodes. Is there a workaround like a different shape of the customdata or a different way to write the hovertemplate?

@antoinerg
Copy link
Contributor

Unfortunately, at the moment, it is not possible to iterate through the customdata from a sankey.node. We would need to do what is described in #4243 (comment) . It shouldn't be too complicated to do. Is this needed urgently?

@emmanuelle
Copy link
Contributor

Thank you @antoinerg. I don't know how urgent this is for @matthewchan15, but there have been several requests on the forum in order to use customdata for hover in a sankey trace (which is not possible at the moment).

@mtwichan
Copy link
Contributor Author

mtwichan commented Mar 9, 2020

If it's not a complicated feature to implement it'd be great to have. This issue has come up for myself as a Dash/Plotly user many times, for users in the community forums (https://community.plot.ly/t/sankey-diagram-customize-tooltip/11487), users at a workshop I gave (for a paying customer - this issue), and now as a feature addition to a POC we're trying to present to sway a client to get DE (https://github.com/plotly/dash-customer-success/issues/248).

I'd say it's urgent in the sense that it could be useful for all the above reasons. But it's not urgent in the sense that no one is paying for it. Up to you @antoinerg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants