Skip to content

LineChart, BarChart, PieChart, etc. Tooltips are unusable on mobile #639

@jchen42703

Description

@jchen42703

Problem

On mobile, when users tap on bars/lines on mobile, they need to hold down on the bar/line to see the tooltip. If they hold down for too long, it will begin highlighting the surrounding text and collapse the tooltip. This makes using the graphs on mobile unusable.

I looked through the layerchart docs and was unable to find any examples that had the popover UX on mobile.

Ideal UX

As described in other issues, Tooltips are not intended to be used for mobile. Instead, we should use Popovers.

ReCharts in Shadcn and Unovis implement this behavior natively:

https://ui.shadcn.com/charts/bar#charts

https://unovis.dev/gallery/view?collection=Bar%20Charts&title=Horizontal%20Stacked%20Bar%20Chart%20with%20Tooltip%20and%20Legend

However, it's not clear on how to implement this in layerchart natively or within Svelte Shadcn

Reproduce Issue

Go to these on your phone:

(Shadcn-Svelte uses layerchart)
https://shadcn-svelte.com/charts/bar#charts

https://www.layerchart.com/docs/examples/Columns

What I Tried

huntabyte/shadcn-svelte#1044
Solutions here with a custom PopoverTooltip component didn't render the popover when using it as a tooltip snippet

Desired Solution

A way to default to Popover behavior on mobile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions