VictoryVoronoiContainer should allow default active points
This would allow users to show a chart with a point / tooltip auto-selected. The chart would still be interactive as usual while the user was hovering over it, but would have a default value otherwise.
This is currently possible in Victory with externalEventMutations, but it's complicated and fiddly.
Proposed API change:
A new prop called defaultVoronoiValue will be added. This prop should be given relative to data space (not svg coordinate space). The point(s) nearest to defaultVoronoiValue will be set active when the chart renders and onMouseLeave
defaultVoronoiValue: PropTypes.oneOfType([
PropTypes.number,
PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number
})
])
This is currently possible in Victory with externalEventMutations
How do I do this?
I don't mind that it's complicated and fiddly, I just make to programmatically set an active point so that the tooltip will appear for that point.
I would also like to know. externalEventMutations are a headache!
@boygirl I too would like to know. I'm reading through this:
https://formidable.com/open-source/victory/docs/victory-shared-events/
But I can't really divine what the proper mutation is to make a single data point active and trigger the tooltip?
@robotkala @boygirl Ok, I worked through this, here's the minimal working example:
https://codesandbox.io/s/adoring-wescoff-s5llb3?file=/src/App.tsx
I think it would be really helpful if another section were added to here:
https://formidable.com/open-source/victory/docs/victory-shared-events
Where instead of sharing events, externalEventMutations were being set with state instead-