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
How to add link label curved linlks. #39
Comments
@vasturiano is there any solution. |
@gdswapnil11 you should calculate where you wish to position your link labels in this part:
This uses the halfway point in between the two nodes. If you wish it to be positioned elsewhere, simply change that calculation. |
hey @vasturiano , i tried this, but can not find right solution ,can u provide me sample code for this. |
@gdswapnil11 which part are you not able to get to work properly? |
@vasturiano my output look like this, label on curved line are over lapping on one position so how do i manage as per link curvature. |
@gdswapnil11 have you tried adjusting the |
hey, @vasturiano yes i have tried adjusting the textPos, here is my sample code
Still my output look like, i have another question that can we use |
@gdswapnil11 do you by chance have a repo of your implementation? I have a similar use case. |
Hey Guys, a little bit of patience and math then I solved the problem this way:
If anyone wants to see here is my code |
@Bomfim thank you |
Hi :) Did anyone get anything better than this? I also tried with this library https://github.com/Viglino/Canvas-TextPath but I find difficult to find the coordinates of the path thanks |
I tried this function and it worked correctly for curved links between 2 nodes, but not correctly for self referencing links (from A to A) @vasturiano can you help with this ? it's probably an issue that the start and end coordinates are the same |
Ok, i was able to get this to work correctly, by updating the formula above to use 4 control pints instead of 2 which is the case for self referencing links :
|
Awesome @moda20, you should be very proud dude |
Am using force-graph in my project and i am using 'linkCurvature ' for curve link and ' .linkCanvasObjectMode' and '.linkCanvasObject' for link label but problem is that am not able to get link label on curved links, how can i do so.
Here i share my code.
`
The text was updated successfully, but these errors were encountered: