techniq / techniq/layerchart

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

Open
#639 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
41
Avg merge
2d 19h
Merged PRs (30d)
16

Description

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

https://github.com/huntabyte/shadcn-svelte/issues/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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked layerchart Columns example and the shadcn-svelte chart reproduction, then review the related shadcn-svelte issue about the custom PopoverTooltip. The work is done when chart interactions on mobile provide a usable popover by default without requiring a long press or causing text selection and tooltip collapse.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, typescript
Domain
data-visualization, frontend, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.