根据react-vis doc,onValueMouseOver
应该同时返回 theevent
和datapoint
. 然而,事件似乎并没有通过。难道我做错了什么?
const Charts = () => {
const data = [
{ x: 1, y: 1 },
{ x: 2, y: 1 },
{ x: 3, y: 5 },
{ x: 4, y: 5 },
{ x: 5, y: 1 },
];
return (
<XYPlot height={400} width={400}>
<VerticalBarSeries
data={data}
onValueMouseOver={(datapoint, event) => {
console.log(event.target); // undefined
}}
/>
</XYPlot>
);
};