VisActor / VisActor/VChart

[Bug] Crash in filterGraphicsByDatum when setHovered receives datums from multiple series (out-of-bounds access on collection marks)

Open
#4,678 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.8k
Forks
221
Avg merge
1d 6h
Merged PRs (30d)
26

Description

Version

2.1.6 (reproduced source-wise; originally found on 2.0.0)

Link to Minimal Reproduction

https://gist.github.com/CrazyBucket/0b6018dd186c1921ba85165c1bbf177b

Steps to Reproduce
  1. Open the reproduction link.
  2. The chart is rendered successfully.
  3. setHovered is called with a datum array that contains more items than the target mark's internal datum array.
  4. Observe the runtime error in the console:
Current Behavior

TypeError: Cannot read properties of undefined (reading 'time')
at index.min.js:15:1476662
at Array.every ()
at index.min.js:15:1476642
at Array.every ()
at index.min.js:15:1476626
at Array.filter ()
at index.min.js:15:1476588
at Array.forEach ()
at index.min.js:15:1476478
at Array.forEach ()

Expected Behavior

setHovered should handle unmatched datum gracefully.

Possible expected behaviors:

  • ignore datum that cannot be matched
  • return without throwing an exception

A user-facing runtime crash should not happen.

Environment
- **OS**: macOS, iOS
- **Browser**: Chromium 139.0.7258.128, Safari (iOS WebKit)
- **Framework**: React
- **VChart Version**: 2.0.0, 2.1.6
Any additional comments?
Background / How we hit this

We use a multi-series health trend chart (blood pressure: systolic & diastolic) and implement cross-series highlighting via setHovered.

When the user touches the chart, we pass one datum per series at the hovered x position:

vchart.setHovered([systolicDatum, diastolicDatum])

I would be happy to submit a PR to fix this issue if the maintainers agree with the proposed direction.

Contributor guide

Open the contributing guide

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 setHovered entry point and trace into filterGraphicsByDatum, using the linked minimal reproduction to reproduce the out-of-bounds access. Verify behavior when the datum array contains items from multiple series, then confirm that unmatched datums are handled without a runtime exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.