3d-force-graph 1.70.7 → 1.70.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -21
- package/dist/3d-force-graph.js +1931 -1970
- package/dist/3d-force-graph.js.map +1 -1
- package/dist/3d-force-graph.min.js +3 -3
- package/example/click-to-focus/index.html +6 -2
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
[![NPM package][npm-img]][npm-url]
|
|
5
5
|
[![Build Size][build-size-img]][build-size-url]
|
|
6
|
-
[![
|
|
6
|
+
[![NPM Downloads][npm-downloads-img]][npm-downloads-url]
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://vasturiano.github.io/3d-force-graph/example/large-graph/"><img width="80%" src="http://gist.github.com/vasturiano/02affe306ce445e423f992faeea13521/raw/preview.png"></a>
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
A web component to represent a graph data structure in a 3-dimensional space using a [force-directed](https://en.wikipedia.org/wiki/Force-directed_graph_drawing) iterative layout.
|
|
13
13
|
Uses [ThreeJS](https://github.com/mrdoob/three.js/)/WebGL for 3D rendering and either [d3-force-3d](https://github.com/vasturiano/d3-force-3d) or [ngraph](https://github.com/anvaka/ngraph.forcelayout3d) for the underlying physics engine.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
See also the [2D canvas version](https://github.com/vasturiano/force-graph), [VR version](https://github.com/vasturiano/3d-force-graph-vr) and [AR version](https://github.com/vasturiano/3d-force-graph-ar).
|
|
16
|
+
|
|
17
|
+
And check out the [React bindings](https://github.com/vasturiano/react-force-graph).
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
16
21
|
* [Basic](https://vasturiano.github.io/3d-force-graph/example/basic/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/basic/index.html))
|
|
17
22
|
* [Asynchronous load](https://vasturiano.github.io/3d-force-graph/example/async-load/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/async-load/index.html))
|
|
18
23
|
* [Larger graph (~4k elements)](https://vasturiano.github.io/3d-force-graph/example/large-graph/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/large-graph/index.html))
|
|
@@ -45,34 +50,30 @@ Check out the examples:
|
|
|
45
50
|
* [Bloom Post-Processing Effect](https://vasturiano.github.io/3d-force-graph/example/bloom-effect/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/bloom-effect/index.html))
|
|
46
51
|
* [Pause / Resume animation](https://vasturiano.github.io/3d-force-graph/example/pause-resume/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/pause-resume/index.html))
|
|
47
52
|
|
|
48
|
-
See also the [2D canvas version](https://github.com/vasturiano/force-graph), [VR version](https://github.com/vasturiano/3d-force-graph-vr) and [AR version](https://github.com/vasturiano/3d-force-graph-ar).
|
|
49
|
-
|
|
50
|
-
And check out the [React bindings](https://github.com/vasturiano/react-force-graph).
|
|
51
|
-
|
|
52
53
|
## Quick start
|
|
53
54
|
|
|
54
|
-
```
|
|
55
|
+
```js
|
|
55
56
|
import ForceGraph3D from '3d-force-graph';
|
|
56
57
|
```
|
|
57
58
|
or
|
|
58
|
-
```
|
|
59
|
-
|
|
59
|
+
```js
|
|
60
|
+
const ForceGraph3D = require('3d-force-graph');
|
|
60
61
|
```
|
|
61
62
|
or even
|
|
62
|
-
```
|
|
63
|
+
```html
|
|
63
64
|
<script src="//unpkg.com/3d-force-graph"></script>
|
|
64
65
|
```
|
|
65
66
|
then
|
|
66
|
-
```
|
|
67
|
-
|
|
67
|
+
```js
|
|
68
|
+
const myGraph = ForceGraph3D();
|
|
68
69
|
myGraph(<myDOMElement>)
|
|
69
|
-
|
|
70
|
+
.graphData(<myData>);
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
## API reference
|
|
73
74
|
|
|
74
75
|
### Initialisation
|
|
75
|
-
```
|
|
76
|
+
```js
|
|
76
77
|
ForceGraph3d({ configOptions })(<domElement>)
|
|
77
78
|
```
|
|
78
79
|
|
|
@@ -209,7 +210,7 @@ ForceGraph3d({ configOptions })(<domElement>)
|
|
|
209
210
|
| <b>screen2GraphCoords</b>(<i>x</i>, <i>y</i>, <i>distance</i>) | Utility method to translate viewport distance coordinates to the graph domain. Given a pair of `x`,`y` screen coordinates and distance from the camera, returns the current equivalent `{x, y, z}` in the domain of graph node coordinates. |
|
|
210
211
|
|
|
211
212
|
### Input JSON syntax
|
|
212
|
-
```
|
|
213
|
+
```json
|
|
213
214
|
{
|
|
214
215
|
"nodes": [
|
|
215
216
|
{
|
|
@@ -222,14 +223,14 @@ ForceGraph3d({ configOptions })(<domElement>)
|
|
|
222
223
|
"name": "name2",
|
|
223
224
|
"val": 10
|
|
224
225
|
},
|
|
225
|
-
|
|
226
|
+
...
|
|
226
227
|
],
|
|
227
228
|
"links": [
|
|
228
229
|
{
|
|
229
230
|
"source": "id1",
|
|
230
231
|
"target": "id2"
|
|
231
232
|
},
|
|
232
|
-
|
|
233
|
+
...
|
|
233
234
|
]
|
|
234
235
|
}
|
|
235
236
|
```
|
|
@@ -238,9 +239,9 @@ ForceGraph3d({ configOptions })(<domElement>)
|
|
|
238
239
|
|
|
239
240
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=L398E7PKP47E8¤cy_code=USD&source=url) If this project has helped you and you'd like to contribute back, you can always [buy me a ☕](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=L398E7PKP47E8¤cy_code=USD&source=url)!
|
|
240
241
|
|
|
241
|
-
[npm-img]: https://img.shields.io/npm/v/3d-force-graph
|
|
242
|
+
[npm-img]: https://img.shields.io/npm/v/3d-force-graph
|
|
242
243
|
[npm-url]: https://npmjs.org/package/3d-force-graph
|
|
243
|
-
[build-size-img]: https://img.shields.io/bundlephobia/minzip/3d-force-graph
|
|
244
|
+
[build-size-img]: https://img.shields.io/bundlephobia/minzip/3d-force-graph
|
|
244
245
|
[build-size-url]: https://bundlephobia.com/result?p=3d-force-graph
|
|
245
|
-
[
|
|
246
|
-
[
|
|
246
|
+
[npm-downloads-img]: https://img.shields.io/npm/dt/3d-force-graph
|
|
247
|
+
[npm-downloads-url]: https://www.npmtrends.com/3d-force-graph
|