Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable click for sunburst or treemap chart with trace, configuration or layout?

Tags:

plotly.js

In plotly.js, I'm trying to disable the animation for a treemap when you click on one of the squares. In my app, there's only one level of parents, so zooming in on a specific square isn't very helpful. I saw a similar question here: https://community.plot.ly/t/sorting-slices-in-sunburst-and-disabling-animations/27558 .

Is there a way I can set this in the trace or configuration instead?

like image 582
M. Adams Avatar asked Dec 02 '25 00:12

M. Adams


1 Answers

You can disable such interaction in a treemap by falsifying the plotly_treemapclick event.

Plotly.newPlot('graph', [{
  type: 'treemap',
  labels: ['Root', 'A', 'B', 'a', 'aa', 'b', 'bb'],
  parents: ['', 'Root', 'Root', 'A', 'A', 'B', 'B']
}])
.then(gd => {
  gd.on('plotly_treemapclick', () => false)
})
like image 97
thierry Avatar answered Dec 09 '25 09:12

thierry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!