-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Update treemap text for each node #4535
Comments
Seems like a bug to me. |
Do you have a codepen showing the problem @archmoj ? |
Here's a working version: https://codepen.io/etpinard/pen/BaygOXo?editors=0010 Remember that the outer array in restyle/update calls maps to trace indices and the inner array maps to data indices. |
So @elv1s42 var upd = {
marker: {colors: ['white', 'orange', 'green', 'red']}, // N.B. here you're replacing all of `marker`, no need to nest
text: [['t1', 't2', 't3', 't4']] // N.B. nested array
};
Plotly.update('myDiv', upd);
//Plotly.restyle('myDiv', upd); should work. To improve performance, I suggest calling var upd = {
'marker.colors': [['white', 'orange', 'green', 'red']],
text: [['t1', 't2', 't3', 't4']]
};
Plotly.update('myDiv', upd);
//Plotly.restyle('myDiv', upd); that way, you only update the marker colors and the text (as opposed to all the marker attributes and the text). |
For more info on our restyle/update call signature, please refer to https://plot.ly/javascript/plotlyjs-function-reference/#plotlyrestyle |
Hi @etpinard! |
Hello!
I'm working with the
treemap
diagram and I need to update color and text for each node without re-drawing the entire diagram. I only was able to update the color and I'm not sure how to update the text.This is my CodePen example: https://codepen.io/elv1s42/pen/yLydprX
I've tried both
update
andrestyle
functions and read the documentation here: https://plot.ly/javascript/plotlyjs-function-reference/#plotlyreact but didn't find the examples of how text can be updated.Please help me to resolve the issue.
Thank you.
The text was updated successfully, but these errors were encountered: