Open sem4phor opened 1 year ago
A potential fix is to handle dates in the getDatasets method of the voronoi helpers:
const voronoiX = x instanceof Date ? new Date((Number(x) + Number(x0)) / 2) : (Number(x) + Number(x0)) / 2;
// same for Y
@boygirl If you agree that this is a bug & the fix above a valid approach to fix it i could open a PR?
Describe the bug I want to create a timeline charts with hoverable scatter points. Therefore I wrapped a scatter chart with a voronoicontainer and a discontinuous scale to fix weekend gaps (there is no trading happening on the weekends resulting in no data points). This breaks because it seems that the voronoicontainer does some internal transformations from date to timestamp and passing it to the scale.
Error: e.getDay is not a function (after debugging e is a timestamp instead of an expected Date)
Victory version Which version are you using? 36.6.8
Code Sandbox link Paste following code to https://formidable.com/open-source/victory/gallery/discontinuous-scale/
To Reproduce Steps to reproduce the behavior:
Expected behavior The tooltip of the voronoi container is displayed and no error in the console is there.
Screenshots![Screenshot 2023-04-28 at 10 01 19](https://user-images.githubusercontent.com/6383149/235091126-883e568a-7b49-4cc4-badf-f208c958a5f2.png)
Desktop (please complete the following information):
Smartphone (please complete the following information):