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

Remove arrows from edges in FruchtermanReingoldAlgorithm [GUIDE] #131

Open
Puzzak opened this issue Oct 3, 2024 · 0 comments
Open

Remove arrows from edges in FruchtermanReingoldAlgorithm [GUIDE] #131

Puzzak opened this issue Oct 3, 2024 · 0 comments

Comments

@Puzzak
Copy link

Puzzak commented Oct 3, 2024

Alright, to be honest this is a pretty easy fix.

Steps

In Android Studio, ctrl + click on the FruchtermanReingoldAlgorithm entry in your code. This one, that is on screenshot:
image

You will arrive at the dartfile for this algorythm. Scroll own below to find the block on screenshot below or search for ArrowEdgeRenderer. ctrl + click on the found entry.
image

You will arrive at the dartfile for arrow renderer. Now search for function drawTriangle, it will look like on the screenshot:
image

Inside the function find line canvas.drawPath(trianglePath, paint); above the comment and make it a comment, like on a screenshot:
image

Then scroll a little down and look at the line var triangleCentroid = [x, y];. Change [x, y] to [x2, y2], so it will look like at the screenshot below:
image

Recompile the app and enjoy your new looks.

Comparison

Here's how it looks without arrows:
image

And here's with default arrows:
image

Explanation

When plugin draws Arrow to the node, it draws the arrow, calculates the arrow center (x, y moment) and passes it back to the function that will draw line to the center of the triangle. So removing drawPath we make the plugin not draw arrow head, and by changing x,y (center of the head) to x2, y2 (top arrow point, the one that points toward the node) we make it not draw the triangle and then draw the line to the point that would be the top of the truangle.

Reasons

I have a lot of Nodes, and they usually all originate from one single Node. Having circular formation of Nodes was hard, since they all overlapped
Thus I had to make them smaller, but arrows are not scaled this way. I wasn't able to find easier way, so I had to change the extension to fit my needs.

I did other changes in the process of making nodes smaller, I will try to make guides for each of them.

Any comments on how to make it more effective are welcome.

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