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
- Open the reproduction link.
- The chart is rendered successfully.
setHovered is called with a datum array that contains more items than the target mark's internal datum array.
- 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.
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
setHoveredis called with a datum array that contains more items than the target mark's internal datum array.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
setHoveredshould handle unmatched datum gracefully.Possible expected behaviors:
A user-facing runtime crash should not happen.
Environment
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:
I would be happy to submit a PR to fix this issue if the maintainers agree with the proposed direction.