How to use js to draw a graph similar to a force digraph?

1. The designer designed the following graph, which is very similar to the force map, so that it can be implemented on the page, and each circle in the graph can click on the trigger event.

clipboard.png

2, my current two ideas:
(1) simple and rude html+css. In addition to the "comprehensive score" of several circles are easy to do, use button to fill the background color or background picture can be done. The "comprehensive score" can make several graphics, and then set different background maps according to the score, and the connection lines between circles can be made into a larger background map, and the rest is the problem of layout. this kind of practice is more troublesome is the layout, especially to adapt to the width, that will be very troublesome.
(2) use the force steering graph of echarts, d3 and other class libraries to do it, and whether it can be well implemented is being studied at present.
3, question: which front-end student with a lot of similar needs gives me a suggestion, thank you.

Mar.01,2021

I finally implemented it with echarts. I made it with reference to the simple graph demo on the official website of echarts. I feel that echarts is still very easy to use, and the results are as follows. Although it is not completely consistent with the design requirements, it can meet the basic needs.

clipboard.png


Thank you for the invitation. It is suggested to implement it with d3, which is very flexible and tests svg foundation and js skills.

echarts currently has no implementation ideas

it is not convenient to implement recently. Sorry


if the size, location and number of each circle will be customized, it would be better to draw directly with the class library

html+css is more suitable for the situation where the position is relatively fixed. If the layout is laid out, the mobile end can do self-adaptation, and the pc can only set the width

.

https://codeshelper.com/a/11.
's own collection, d3.js

Menu