plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.14k stars 1.87k forks source link

Allow indexing data in pmeta using x and y coordinates #4145

Open orenbenkiki opened 5 years ago

orenbenkiki commented 5 years ago

Problem Description.

Displaying a heatmap, I'd like to include in the hover box some data which depends only on the X (column) or Y (row).

Describe the solution you'd like

Allow specifying %{data.pmeta.foo.%{x}} and/or %{data.pmeta.bar.%{y}} in the hovertemplate. In general, if a path element is in the format %{...}, then evaluate it, and use this as the next key.

Describe alternatives you've considered

It is possible to specify per-entry hover text for a heatmap, but this would require precomputing and sending much more data between the client and the server (N * M complete texts instead of N + M text fragments).

etpinard commented 5 years ago

Thanks for writing in.

In your proposed %{data.pmeta.foo.%{x}}, is %{x} a (string) key or a (number) index?

orenbenkiki commented 5 years ago

Good question...

I think that %{x} should be a string and be used as a key. After all, a normal %{x} expands into a string.

Perhaps an additional syntax such as [%{x}] should be allowed if x is known to be an integer and the data is known to be an array. "Explicit is better than implicit" :-)

gvwilson commented 5 months ago

Hi - we are currently trying to tidy up Plotly's public repositories to help us focus our efforts on things that will help users most. Since this issue has been sitting for several years, I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our backlog. Thanks for your help - @gvwilson

orenbenkiki commented 5 months ago

Yes, this is still a concern. But after almost 5 years, is there much point in re-opening it? Perhaps you should have changed the status to "won't fix" rather than "completed".

gvwilson commented 5 months ago

thanks @orenbenkiki - I'll reopen and assign to myself, and try to get it into our backlog.

orenbenkiki commented 5 months ago

Thanks!