vasturiano/force-graph

Can I customize a color gradient link

liuguanyu opened this issue · 2 comments

Hello.

There is a orange node and a blue node on the canvas. I want to customize a color gradient link, from blue to orange, using force-graph. just like the following pictures:

image

These are the nodes.

image

The above is the link.

Is it possible to customize the color gradient link?

Thanks a lot.

@liuguanyu you can use linkCanvasObject to customize the style of your links in whichever way you'd like. For example to add a gradient to the line. Essentially you issue canvas paint commands, so if something is possible in canvas it should be possible here.

You can look into createLinearGradient to achieve this.

@liuguanyu you can use linkCanvasObject to customize the style of your links in whichever way you'd like. For example to add a gradient to the line. Essentially you issue canvas paint commands, so if something is possible in canvas it should be possible here.

You can look into createLinearGradient to achieve this.

Thanks