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

get the tooltip value inside onClick #84

Open
samuira opened this issue May 31, 2022 · 1 comment
Open

get the tooltip value inside onClick #84

samuira opened this issue May 31, 2022 · 1 comment

Comments

@samuira
Copy link

samuira commented May 31, 2022

How can I get the tooltip value when we clicked on any node? can you show a example code?
function clicked(d){
if (d.children){
sunburst_chart.focusOnNode(d)
}else {
// get the tooltip value like ( A -> B -> C)
}

}

@vasturiano
Copy link
Owner

@samuira the node's data is included in the onClick method. This data object has a convenience attribute called __dataNode which includes links to all the children and parent nodes. By iterating over the parent link chain you'll be able to extract all the stack until the root, giving you what you're looking for.

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

No branches or pull requests

2 participants