Skip to content

docs: correct showspikes hovermode description - #7981

Merged
emilykl merged 6 commits into
plotly:mainfrom
CAOShurong:docs/showspikes-hovermode
Aug 27, 2026
Merged

docs: correct showspikes hovermode description#7981
emilykl merged 6 commits into
plotly:mainfrom
CAOShurong:docs/showspikes-hovermode

Conversation

@CAOShurong

Copy link
Copy Markdown
Contributor

Fixes the documentation part of #7595.

The showspikes description claimed:

Note: This only takes affect when hovermode = closest

but this is not accurate. Spikes are drawn in all cartesian hovermodes:

  • src/components/fx/hover.js (the second spike-point block, when hoverData.length !== 0) filters hover points by point.xa.showspikes / point.ya.showspikes regardless of which of x, y, x unified, y unified or closest is active — only the snap target differs (cursor position vs. nearest data point).
  • The repo's own test suite asserts spikelines render with hovermode: 'x': test/jasmine/tests/hover_spikeline_test.js cases around L506-521 expect 4 spikeline elements after hovering in x mode.

Change: replaces the incorrect note with a per-hovermode description:

Determines whether or not spikes (aka droplines) are drawn for this axis. In closest hovermode, spikes are only drawn when hovering near a data point. In x, y, x unified, and y unified hovermodes, spikes are also drawn at the current cursor position on the axis.

Docs-only change to one attribute description in src/plots/cartesian/layout_attributes.js; no behavior change, so no new tests and no changelog entry beyond this fix.

@emilykl emilykl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @CAOShurong, thanks for working on this attribute description.

The correction isn't quite accurate: when showspikes is true, spikes are drawn according to the behavior specified by spikesnap (which defaults to drawing spikes at the closest data point).

Can you adjust the attribute description to read:

            'Determines whether or not spikes (aka droplines) are drawn for this axis.',
            'Note that spikes will never be drawn when `hovermode` is *false*.'

@CAOShurong

Copy link
Copy Markdown
Contributor Author

Addressed the requested documentation wording in commit 874b63b13.

  • showspikes now uses the exact requested description: spikes are never drawn when hovermode is false.
  • Regenerated test/plot-schema.json entries and updated the draftlog.
  • node --check src/plots/cartesian/layout_attributes.js, JSON parsing of test/plot-schema.json, and git diff --check pass.

The branch is ready for re-review. AI assistance remains disclosed in the PR body.

CAOShurong and others added 5 commits August 28, 2026 03:59
The description claimed showspikes only takes effect when
hovermode is 'closest'. In fact spikes are also drawn in 'x', 'y',
'x unified' and 'y unified' hovermodes: hover.js filters hoverData
by ax.showspikes regardless of which cartesian hovermode is active
(src/components/fx/hover.js, second spike-point block). The repo's
own test suite asserts spikelines render with hovermode 'x'
(test/jasmine/tests/hover_spikeline_test.js).

Replaces the incorrect note with an accurate per-hovermode
description. Fixes part of plotly#7595.
Signed-off-by: Shurong Cao <CAOShurong@users.noreply.github.com>
@CAOShurong
CAOShurong force-pushed the docs/showspikes-hovermode branch from 874b63b to d5f9474 Compare August 27, 2026 20:00
@CAOShurong

Copy link
Copy Markdown
Contributor Author

Follow-up in commit d5f9474b6: the branch is now rebased onto the current PR base and includes the generated TypeScript schema description plus the generator-compatible no-final-newline form of test/plot-schema.json.

This addresses the two generated-artifact checks that were red on the previous push. The remaining red jobs in that run were the repository's flaky flaky-no-gl-jasmine and test-baselines image comparison (map_symbol-text), unrelated to this docs-only change.

git diff --check and local JavaScript/JSON syntax checks pass; ready for re-review.

@CAOShurong

Copy link
Copy Markdown
Contributor Author

The follow-up head 77fc50325c3b5d7e26465196cca2a675120531f1 now has a fully successful CI run, including schema/type-generation and all Jasmine/baseline jobs. The exact requested showspikes wording is in place and the branch is ready for re-review.

@emilykl

emilykl commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

@CAOShurong Thanks for the update, this looks ready to go.

FWIW, I don't see a disclosure of AI assistance in the PR description. We don't require disclosure of AI assistance, but we do ask that changes related to plot interactivity or visuals are thoroughly verified in the browser before opening a PR.

@emilykl
emilykl merged commit cc143a1 into plotly:main Aug 27, 2026
164 of 166 checks passed
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