Hovering on plots in mobile

I have an app (in production) and I’m just starting to learn Plotly plots. (Yeah, yeah, trapezing with no net.) I really like the hover behavior which enables the user to see the x values in a bar chart. Clicking on a particular bar brings up an alert box with auxiliary data. This works great, and is otherwise infeasible because there are too many bars to have every one labeled.

But I’m asking for advice: what do I do when the user is on mobile, which lacks hover behavior? Clicking bars still works great, but there’s no way to see what bar you’re clicking…

I’m not much help here (I have writer’s block), but as a principle could you make the initial click imitate the hover action, then have a “show details” button on/near the hover info to popup the aux data?

Interesting. It’s no problem at all to have an initial click mimic the hover action, though I’d have to learn how to program a popover, which I’ve been intending to do. And then somehow the user would have to interact with the popover. It’s still a little unwieldy to have to click to see the popover which comes up automatically on a non-mobile device. But it’s an idea… Thanks.

But even if I get that to work, there’ll be another problem, which is that I definitely don’t want the popovers on a desktop, so there’d have to be some sort of media query script as well…

I think @stucork has a library for this somewhere on the Anvil site (I don’t have the link handy).

It’s now part of Anvil Extras

1 Like