Skip to content
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

Touch crosshair for line graphs #2524

Merged
merged 17 commits into from
Mar 5, 2024
Merged

Conversation

WilliamABradley
Copy link
Contributor

This adds the ability to shift the crosshair on mobile by touching and holding along the graph surface just like Google's Stock and Exchange rate graphs, which you can run your finger along on mobile.

This option is only available in mesh mode, as it appears that slices would have to be refactored to figure out when touchMove moves across different elements.

Also, it seems that in order to build, I needed to add:

    "@babel/preset-env": "^7.21.5",
    "@babel/preset-react": "^7.18.6",
    "@babel/preset-typescript": "^7.21.5",

Not sure if the package lock is wonk, or if the issue is me being on Windows.

Copy link

vercel bot commented Mar 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nivo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2024 7:36am

Copy link

codesandbox-ci bot commented Mar 2, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit fd757b9:

Sandbox Source
nivo Configuration

packages/line/src/Mesh.js Show resolved Hide resolved
packages/tooltip/src/context.ts Show resolved Hide resolved
packages/voronoi/src/Mesh.tsx Outdated Show resolved Hide resolved
packages/voronoi/src/Mesh.tsx Show resolved Hide resolved
packages/voronoi/src/Mesh.tsx Show resolved Hide resolved
packages/line/index.d.ts Show resolved Hide resolved
@WilliamABradley
Copy link
Contributor Author

@plouc I've address the feedback 🙂
Not sure why vercel preview is failing and I can't access any logs. Do you know why?

Copy link
Owner

@plouc plouc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the adjustments!

@plouc
Copy link
Owner

plouc commented Mar 5, 2024

@plouc I've address the feedback 🙂 Not sure why vercel preview is failing and I can't access any logs. Do you know why?

@WilliamABradley, the build fails due to a missing default value for the new property, did you try to build the website locally?

@WilliamABradley
Copy link
Contributor Author

WilliamABradley commented Mar 5, 2024

I can take a look at the website build tonight 🙂

Also, I think I need to add support for slices to this feature, as my use case doesn't actually need the voronoi mesh (I think maybe it is worth describing the purpose of slices in the documentation as I didn't understand why it was needed, and what this difference between slices and mesh was).

Correct me if I'm wrong, slices allows for a vertical/horizontal crosshair tracking on one axis, rather than Voronoi which is closest point reguardless of axis? It felt unnatural for my FX graph for the crosshair to be skipping around (Due to different high and low points), which I only gathered from turning on the separate debug flags.

Are you happy for me to add that slice support to this PR or would it make sense to make another?

@plouc
Copy link
Owner

plouc commented Mar 5, 2024

I can take a look at the website build tonight 🙂

Thank you :)

Also, I think I need to add support for slices to this feature, as my use case doesn't actually need the voronoi mesh (I think maybe it is worth describing the purpose of slices in the documentation as I didn't understand why it was needed, and what this difference between slices and mesh was).

Correct me if I'm wrong, slices allows for a vertical/horizontal crosshair tracking on one axis, rather than Voronoi which is closest point reguardless of axis? It felt unnatural for my FX graph for the crosshair to be skipping around (Due to different high and low points), which I only gathered from turning on the separate debug flags.

Slices can be useful when you want to visualize a "slice" of data all at once when hovering a point belonging to that slice, while with the voronoi mesh we only show one data point. The voronoi mesh is also useful for very dense charts, as it can become difficult to hover a specific point, but it could be improved, for example by adding a secondary radius to restrict the detection, so that it's not constantly jumping around.

Are you happy for me to add that slice support to this PR or would it make sense to make another?

This PR is fine.

sebald referenced this pull request in sebald/pattern-analyzer Mar 10, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@nivo/axes](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/axes)) |
[`0.84.0` ->
`0.85.1`](https://renovatebot.com/diffs/npm/@nivo%2faxes/0.84.0/0.85.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2faxes/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2faxes/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2faxes/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2faxes/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/bar](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/bar)) |
[`0.84.0` ->
`0.85.1`](https://renovatebot.com/diffs/npm/@nivo%2fbar/0.84.0/0.85.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fbar/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fbar/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fbar/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fbar/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/core](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/core)) |
[`0.84.0` ->
`0.85.1`](https://renovatebot.com/diffs/npm/@nivo%2fcore/0.84.0/0.85.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fcore/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fcore/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fcore/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fcore/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/line](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/line)) |
[`0.84.0` ->
`0.85.1`](https://renovatebot.com/diffs/npm/@nivo%2fline/0.84.0/0.85.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fline/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fline/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fline/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fline/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/pie](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/pie)) |
[`0.84.0` ->
`0.85.1`](https://renovatebot.com/diffs/npm/@nivo%2fpie/0.84.0/0.85.1) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fpie/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fpie/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fpie/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fpie/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/scatterplot](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/scatterplot))
| [`^0.84.0` ->
`^0.85.0`](https://renovatebot.com/diffs/npm/@nivo%2fscatterplot/0.84.0/0.85.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fscatterplot/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fscatterplot/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fscatterplot/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fscatterplot/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@nivo/swarmplot](https://github.com/plouc/nivo)
([source](https://github.com/plouc/nivo/tree/HEAD/packages/swarmplot))
| [`^0.84.0` ->
`^0.85.0`](https://renovatebot.com/diffs/npm/@nivo%2fswarmplot/0.84.0/0.85.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@nivo%2fswarmplot/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@nivo%2fswarmplot/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@nivo%2fswarmplot/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@nivo%2fswarmplot/0.84.0/0.85.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>plouc/nivo (@&#8203;nivo/axes)</summary>

### [`v0.85.1`](https://github.com/plouc/nivo/releases/tag/v0.85.1)

[Compare
Source](https://github.com/plouc/nivo/compare/v0.85.0...v0.85.1)

#### What's Changed

- Tooltip: avoid a flash effect and weird initial transition by
[@&#8203;DimaAmega](https://github.com/DimaAmega) in
[https://github.com/plouc/nivo/pull/2480](https://github.com/plouc/nivo/pull/2480)
- feat(deps): upgrade d3-scale due to vulnerability by
[@&#8203;plouc](https://github.com/plouc) in
[https://github.com/plouc/nivo/pull/2531](https://github.com/plouc/nivo/pull/2531)

#### New Contributors

- [@&#8203;DimaAmega](https://github.com/DimaAmega) made their first
contribution in
[https://github.com/plouc/nivo/pull/2480](https://github.com/plouc/nivo/pull/2480)

**Full Changelog**:
plouc/nivo@v0.85.0...v0.85.1

### [`v0.85.0`](https://github.com/plouc/nivo/releases/tag/v0.85.0)

[Compare
Source](https://github.com/plouc/nivo/compare/v0.84.0...v0.85.0)

#### What's Changed

- refactor default props to fix error message by
[@&#8203;andre19980](https://github.com/andre19980) in
[https://github.com/plouc/nivo/pull/2452](https://github.com/plouc/nivo/pull/2452)
- fix(sankey): update onClick types in sankey chart to respect generics
by [@&#8203;stas-demydiuk](https://github.com/stas-demydiuk) in
[https://github.com/plouc/nivo/pull/2509](https://github.com/plouc/nivo/pull/2509)
- chore: upgrade d3-color and d3-scale-chromatic by
[@&#8203;icco](https://github.com/icco) in
[https://github.com/plouc/nivo/pull/2466](https://github.com/plouc/nivo/pull/2466)
- Fix: add initial property for truncateTickAt by
[@&#8203;scalabw](https://github.com/scalabw) in
[https://github.com/plouc/nivo/pull/2504](https://github.com/plouc/nivo/pull/2504)
- fix tooltip default color by
[@&#8203;scalabw](https://github.com/scalabw) in
[https://github.com/plouc/nivo/pull/2521](https://github.com/plouc/nivo/pull/2521)
- Touch crosshair for line graphs by
[@&#8203;WilliamABradley](https://github.com/WilliamABradley) in
[https://github.com/plouc/nivo/pull/2524](https://github.com/plouc/nivo/pull/2524)
- fix(marimekko): use readonly arrays for props as the library does not
modify them by [@&#8203;pcorpet](https://github.com/pcorpet) in
[https://github.com/plouc/nivo/pull/2493](https://github.com/plouc/nivo/pull/2493)
- fix(line): use readonly arrays for props as the library does not
modify them by [@&#8203;pcorpet](https://github.com/pcorpet) in
[https://github.com/plouc/nivo/pull/2494](https://github.com/plouc/nivo/pull/2494)
- Fix (peer) dependencies by
[@&#8203;marvinruder](https://github.com/marvinruder) in
[https://github.com/plouc/nivo/pull/2528](https://github.com/plouc/nivo/pull/2528)

#### New Contributors

- [@&#8203;andre19980](https://github.com/andre19980) made their first
contribution in
[https://github.com/plouc/nivo/pull/2452](https://github.com/plouc/nivo/pull/2452)
- [@&#8203;stas-demydiuk](https://github.com/stas-demydiuk) made their
first contribution in
[https://github.com/plouc/nivo/pull/2509](https://github.com/plouc/nivo/pull/2509)
- [@&#8203;icco](https://github.com/icco) made their first
contribution in
[https://github.com/plouc/nivo/pull/2466](https://github.com/plouc/nivo/pull/2466)
- [@&#8203;scalabw](https://github.com/scalabw) made their first
contribution in
[https://github.com/plouc/nivo/pull/2504](https://github.com/plouc/nivo/pull/2504)
- [@&#8203;WilliamABradley](https://github.com/WilliamABradley) made
their first contribution in
[https://github.com/plouc/nivo/pull/2524](https://github.com/plouc/nivo/pull/2524)
- [@&#8203;marvinruder](https://github.com/marvinruder) made their
first contribution in
[https://github.com/plouc/nivo/pull/2528](https://github.com/plouc/nivo/pull/2528)

**Full Changelog**:
plouc/nivo@v0.84.0...v0.85.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/sebald/pattern-analyzer).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIzMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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 this pull request may close these issues.

2 participants