Open l99057j opened 9 months ago
Since it's an HTML, you can just get the dom element of that specific node via pre set id or class using js and update it like that
Or probably a better way would be
function refreshNode(id) {
let attrs = chart.getChartState()
attrs.svg
.selectAll(".node-foreign-object-div")
.filter(x => x.id == id);
.html(function (d, i, arr) {
return attrs.nodeContent.bind(this)(d, i, arr, attrs)
})
}
}
I'm using the library to display a hierarchical workflow with the status of each task being updated in real time. After the initial display of the chart, a SignalR connection is established. When a task's status changes, a message is received and the underlying chart data is updated...
let task = chart.data().find(x => x.id.toLowerCase() === status.taskId.toLowerCase()); if (task) { task.status = status.taskStatus; task.startTime = status.startTime; task.finishTime = status.finishTime; }
... and I then refresh the node like so...
function refreshNode(id) { let node = chart.getChartState().allNodes.find(x => x.id == id); if (node) { chart.update(node); } }
Console statements in my nodeContent function show that even though I'm passing a node to chart.update ALL nodes are being re-rendered. Is there a way to force an update on a single node to avoid unnecessary processing?