After I built a sunburst graph, I would like to select a parent to get the parent name and its children. There are properties for sunburst graph:
[‘id’, ‘clickData’, ‘clickAnnotationData’, ‘hoverData’, ‘clear_on_unhover’, ‘selectedData’, ‘relayoutData’, ‘extendData’, ‘restyleData’, ‘figure’, ‘style’, ‘className’, ‘animate’, ‘animation_opt
ions’, ‘config’, ‘loading_state’]
Where I can find the descriptions for the properties. I checked ‘https://plot.ly/python/reference/#sunburst’ and there are not property description for above properties.
I tried ‘clickData’, ‘selectedData’ and ‘extendData’, none of them returned information when I click the suuburst graph.
‘hoverData’ works but it is so sensitive, it is hard to use mouse to focus on one node. It is easily hover over to another node.
I would like to get info from the clickData or SelectedData (such as ‘parent’ to update the sunburst with different format. ‘hoverdata’ is so sensitive and provides unwanted data when hovering over the graph.
@app.callback(Output(‘sun’, ‘figure’), [Input(‘sun’, ‘hoverData’)]) #[Input(‘sun’, ‘clickData’)]) #[Input(‘sun’, ‘selectedData’)])
def updatesun(data):
print(data)
if data is None:
trace = sundata()
else:
trace = sub_sundata(data)
@pengchuzhang
it’s hard to read your code when it’s not in preformatted text. In addition, without context about your dataframe, it’s hard for me to help. I would say start from the basics.
Try to run this code below on a new .py file. If it works, then try to recreate the same sunburst with your own data, but without callbacks. Then, if you succeed with that, try to add callbacks. Hope that helps.
Thanks for the comments. The problem is that the version of my plotly was 4.3, after upgrading to 4.4.1, it does work now. I am still testing the properties.
Pengchu
Yes - The Path command works great, but its not yet implemented in chart studio. I went to the trouble of coding the needed navigation lines into the chart studio sunburst - and got it to work. I was hoping to use the click option on leafs, but I can’t see a solution to that problem as yet.
I posted the image above that shows the link that I want to click and open (a url page)
For clicking and links, I think the only way you can do this right now is by embedding the <a> inside the text rather than the hover text. The, you’d click on the text directly rather than trying to click on the hover label. So in your picture above, “Purchasing power parity” would be a link, you’d format it like [..., <a href="http://csq1.org/info/NY.GDP...">Purcashing power parity</a>', ...]
I see it’s been nearly 3) since this topic started. Actually I have a similar case right now - depending on selection on sunburst I would like to display data in DataTable. Did you manage to make selectedData work with sunburst?
It looks like clickData is a bit weird and does not really help.