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

Graph not updating when data changes. (TreevizReact) #125

Open
SamiraHuber opened this issue Apr 10, 2023 · 0 comments
Open

Graph not updating when data changes. (TreevizReact) #125

SamiraHuber opened this issue Apr 10, 2023 · 0 comments

Comments

@SamiraHuber
Copy link

SamiraHuber commented Apr 10, 2023

When data changes, the graph stays the same. I updated the percentage, but it is not changing in the graph. I also updated the selectedNode to change the color. But same. Here is my example code:

<TreevizReact
    data={data}
    idKey={'id'}
    relationnalField={'father'}
    nodeWidth={200}
    mainAxisNodeSpacing={2}
    secondaryAxisNodeSpacing={1.3}
    renderNode={(node: any) =>
        `<div style="height:${node.settings.nodeHeight}px;
        display:flex;
        align-items:center;
        background-color:${props.selectedNode?.id == node.data['id'] ? '#cccccc' : '#dfe8df'};
        border-radius: 0.3em;
        padding: 1em;
        margin-left:12px"
        id=${node.data['id']}>
        Node name: ${node.data['name'].split('|')[0]}
        Percentage: ${node.data['percentage']}
        </div>`
    }
    onNodeClick={(event: any) => {
        if (event?.target?.id != null) {
            props.setSelectedNode(ingredients.find((node: any) => node?.id == event?.target?.id));
        }

    }}
    duration={500}
    linkWidth={(node: any) => (node['weight'] * 100)}
    linkShape={'quadraticBeziers'}
/>
@SamiraHuber SamiraHuber changed the title Graph not updating when data changes. Graph not updating when data changes. (TreevizReact) Apr 10, 2023
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

1 participant