Skip to content

Update treemap text for each node #4535

@elv1s42

Description

@elv1s42

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 and restyle 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.

    var upd = { 
      marker: {colors: ['white', 'orange', 'green', 'red']},
      text: ['t1', 't2', 't3', 't4'] // how to update the text?
    };
    Plotly.update('myDiv', upd);
    //Plotly.restyle('myDiv', upd);

Please help me to resolve the issue.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions