Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMouseEnter/Leave functions are not exported within TypeScript-Type definitions #724

Closed
kumarunster opened this issue Oct 23, 2019 · 4 comments · Fixed by #1619
Closed
Labels

Comments

@kumarunster
Copy link

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 #295 and PR #280

do you want PR for this issue?

@kumarunster
Copy link
Author

any comment on this?

@stale
Copy link

stale bot commented Oct 29, 2020

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!

@stale stale bot added the stale label Oct 29, 2020
@kumarunster
Copy link
Author

bump

@stale stale bot removed the stale label Oct 30, 2020
@wyze wyze added 📊 bar @nivo/bar package bug typescript labels Oct 31, 2020
@wyze
Copy link
Contributor

wyze commented Nov 18, 2020

do you want PR for this issue?

Definitely send a PR to add these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants