in current Bar/Pie versions
"@nivo/bar": "^0.59.2",
"@nivo/pie": "^0.59.1",
TypeScript property definitions for onMouseEnter/Leave are missing, hence instantiating nivo charts with onMouseEnter/Leave functions is not possible or not intuitive.
my current workaround is
const chartProps: BarSvgProps = {
//init with regular props
}
//expand properties with mouse enter/leave handler
Object.assign(chartProps, {
onMouseEnter: (data: BarExtendedDatum, event: React.MouseEvent<HTMLCanvasElement>) => {
event.currentTarget.style.cursor = 'pointer'
event.currentTarget.style.strokeWidth = '2'
event.currentTarget.style.opacity = '0.8'
},
onMouseLeave: (data: BarExtendedDatum, event: React.MouseEvent<HTMLCanvasElement>) => {
event.currentTarget.style.cursor = 'auto'
event.currentTarget.style.strokeWidth = '' + borderWidth
event.currentTarget.style.opacity = '1'
}
})
return new ResponsiveBar(chartProps)
More context:
this functions were added with https://github.com/plouc/nivo/issues/295 and PR https://github.com/plouc/nivo/pull/280
do you want PR for this issue?
any comment on this?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
do you want PR for this issue?
Definitely send a PR to add these!
Most helpful comment
any comment on this?