Skip to content

Remove arrows from edges in FruchtermanReingoldAlgorithm [GUIDE] #131

@Puzzak

Description

@Puzzak

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions