Nivo: onMouseEnter/Leave functions are not exported within TypeScript-Type definitions

Created on 23 Oct 2019  路  4Comments  路  Source: plouc/nivo

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?

bar bug typescript

Most helpful comment

any comment on this?

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tj picture tj  路  4Comments

Buvaneshkumar7 picture Buvaneshkumar7  路  3Comments

indvstry picture indvstry  路  3Comments

Haaziq-Uvais picture Haaziq-Uvais  路  3Comments

cedmax picture cedmax  路  4Comments