Blazor-Diagrams / Blazor.Diagrams

A fully customizable and extensible all-purpose diagrams library for Blazor
https://blazor-diagrams.zhaytam.com
MIT License
919 stars 176 forks source link

Enhancement request: Auto-select all links on node click #258

Closed rslavey closed 1 year ago

rslavey commented 1 year ago

I'm using this tool to generate a graph based on data from a database. I have it laid out and it looks good. What I'd like to be able to do is click on a node and all of the connected links are highlighted so the person looking at the graph can easily see parent and child nodes for this node (we use top connections for parents, bottom connections for children, like a flowchart).

I thought it might be as simple as setting the link to "Selected" in code, but it is read-only.

image

Desired result:

image

zHaytam commented 1 year ago

Hi, please use Digram.SelectModel instead. Something like this should work:

Diagram.UnselectAll();

foreach (var link in ...)
{
    Diagram.SelectModel(link, unselectOthers: false);
}
rslavey commented 1 year ago

Thank you. I'm trying to trigger this from a component by passing a method to the component and using InvokeAsync(). However, the command: ...

Edit: I was able to do it using the Diagram.SelectionChanged action and a custom ChartNode class. Thanks for the assist!

2022-10-27_14-47-40_AdobeExpress_AdobeExpress