|
1 |
| -# 🔆 [vue-d3-network-graph](https://la-fabrique.github.io/vue-d3-network-graph/) 🔆 |
| 1 | +# 🔆 vue-d3-network-graph |
2 | 2 |
|
3 |
| -> inspired by https://github.com/emiliorizzo/vue-d3-network |
| 3 | +## 📚 Examples & Documentation |
| 4 | + |
| 5 | +- Examples are available with [hitoire](https://la-fabrique.github.io/vue-d3-network-graph/histoire/) |
| 6 | +- See [Documentation](https://la-fabrique.github.io/vue-d3-network-graph/) |
4 | 7 |
|
5 | 8 | ## 💫 Key features
|
6 | 9 |
|
7 |
| -- Directed links (svg markers). see [D3LayoutOptions:directed](docs/modules.md#d3layoutoptions) and [D3Link:twoWay](docs/modules.md#d3link) |
| 10 | +- Directed links (svg markers). see [D3LayoutOptions:directed](https://la-fabrique.github.io/vue-d3-network-graph/modules.md#d3layoutoptions) and [D3Link:twoWay](https://la-fabrique.github.io/vue-d3-network-graph/modules.md#d3link) |
8 | 11 | - 'Static' mode to use d3-force tick instead of simulation.restart (No rendering of vue components on each tick)
|
9 |
| -- Composition function : [useSimulation](docs/modules.md#usesimulation) (renderless use of d3 simulation) |
| 12 | +- Node groups |
| 13 | +- Custom SVG nodes |
| 14 | +- CSS theming with dark mode support |
| 15 | +- Fixed node position |
10 | 16 | - Typescript support
|
11 |
| -- Vue 3.3 features ([c-bind in css](https://vuejs.org/api/sfc-css-features.html#v-bind-in-css), [readonly ref from getter](https://vuejs.org/api/reactivity-utilities.html#toref) ) |
| 17 | +- Vue 3.3 features ([readonly ref from getter](https://vuejs.org/api/reactivity-utilities.html#toref) ) |
12 | 18 | - VueUse : [useResizeObserver](https://vueuse.org/core/useResizeObserver/), [watchDebounced](https://vueuse.org/shared/watchDebounced/#watchdebounced)
|
13 |
| - |
14 |
| -## 📦 Install |
15 |
| - |
16 |
| -```bash |
17 |
| -npm install vue-d3-network-graph@beta |
18 |
| -``` |
19 |
| - |
20 |
| -> Not production ready yet, use at your own risk. Api may change. |
21 |
| -
|
22 |
| -## 🛠️ Usage |
23 |
| - |
24 |
| -```html |
25 |
| -<template> |
26 |
| - <div id="app"> |
27 |
| - <D3NetworkGraph :nodes="nodes" :links="links" /> |
28 |
| - </div> |
29 |
| -</template> |
30 |
| -<script lang="ts"> |
31 |
| - import { D3NetworkGraph } from "vue-d3-network-graph"; |
32 |
| - import "vue-d3-network-graph/dist/style.css"; |
33 |
| -
|
34 |
| - const nodes = ref([ |
35 |
| - { id: 1, name: "my awesome node 1", innerSVG: database }, |
36 |
| - { id: 2, name: "my node 2", innerSVG: bloc }, |
37 |
| - { id: 3, name: "orange node" }, |
38 |
| - { id: 4, name: "blue node" }, |
39 |
| - { id: 5, name: "G1 - 1", group: 1 }, |
40 |
| - { id: 6, name: "G1 - 2", group: 1 }, |
41 |
| - { id: 7, name: "G1 - 3", group: 1 }, |
42 |
| - { id: 8, name: "G2 - 1", group: 2 }, |
43 |
| - { id: 9, name: "G2 - 2", group: 2 }, |
44 |
| - { id: 10, name: "G2 - 3", group: 2 }, |
45 |
| - { id: 11 }, |
46 |
| - { id: 12 }, |
47 |
| - { id: 13 }, |
48 |
| - { id: 14 }, |
49 |
| - ]); |
50 |
| - const links = ref([ |
51 |
| - { source: 2, target: 1, name: "Utilise" }, |
52 |
| - { source: 4, target: 3, name: "Utilise" }, |
53 |
| - { source: 4, target: 2, name: "Utilise" }, |
54 |
| - { source: 4, target: 9, name: "Utilise" }, |
55 |
| - { source: 5, target: 6, name: "Utilise" }, |
56 |
| - { source: 7, target: 8, name: "Utilise" }, |
57 |
| - { source: 5, target: 8, name: "Utilise" }, |
58 |
| - { source: 3, target: 8, name: "Utilise" }, |
59 |
| - { source: 7, target: 9, name: "Utilise" }, |
60 |
| - { source: 3, target: 9 }, |
61 |
| - { source: 10, target: 6 }, |
62 |
| - { source: 11, target: 6 }, |
63 |
| - { source: 12, target: 6 }, |
64 |
| - { source: 13, target: 6 }, |
65 |
| - { source: 14, target: 6 }, |
66 |
| - ]); |
67 |
| -</script> |
68 |
| -``` |
69 |
| - |
70 |
| -# 🖥️ API |
71 |
| - |
72 |
| -See [API documentation](docs/modules.md) |
73 |
| - |
74 |
| -## D3NetworkGraph Component |
75 |
| - |
76 |
| -**props** |
77 |
| - |
78 |
| -| Name | Type | Default | Description | |
79 |
| -| -------- | --------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- | |
80 |
| -| nodes | Array<[D3Node](docs/modules.md#d3node)> | [] | Array of nodes | |
81 |
| -| links | Array<[D3Link](docs/modules.md#d3link)> | [] | Array of links | |
82 |
| -| options? | [D3Options](docs/modules.md#d3options) | undefined | [Links](docs/modules.md#d3linkoptions), [nodes](docs/modules.md#d3nodeoptions) and [simulation](docs/modules.md#d3simulationoptions) Options | |
83 |
| - |
84 |
| -**events** |
85 |
| - |
86 |
| -| Name | Type | Description | |
87 |
| -| ------------ | ---------------------------------------------- | --------------------------------------------------- | |
88 |
| -| 'node-click' | [function](docs/modules.md#d3neworkgraphemits) | Callback function called when a node is clicked | |
89 |
| -| 'link-click' | [function](docs/modules.md#d3neworkgraphemits) | Callback function called when a node is mouseovered | |
90 |
| - |
91 |
| -# 🪴What next ? |
92 |
| - |
93 |
| -- [x] Zoom-Pan |
94 |
| -- [ ] Enforce better option API |
95 |
| -- [ ] Enforce better css API |
96 |
| -- [ ] Children nodes group |
97 |
| -- [ ] Mobile support |
98 |
| -- [ ] Selection |
99 |
| -- [ ] Custom forces |
100 |
| -- [ ] Remove third party dependencies |
101 |
| - |
102 |
| -> Issues and PR are welcome ! |
103 |
| -
|
104 |
| -# 👨🚀 Contributors |
105 |
| - |
106 |
| -<ul style="list-style: none; display: flex; flex-wrap: wrap;"> |
107 |
| - <li style="margin-bottom:8px; margin-right:8px"> |
108 |
| - <a href="https://github.com/deka" class="" data-hovercard-type="user" data-hovercard-url="/users/deka/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self"> |
109 |
| - <img src="https://avatars.githubusercontent.com/u/349156?s=64&v=4" alt="@deka" size="32" height="32" width="32" data-view-component="true" class="avatar circle"> |
110 |
| - </a> |
111 |
| - </li> |
112 |
| - <li style="margin-bottom:8px; margin-right:8px"> |
113 |
| - <a href="https://github.com/dependabot" class=""> |
114 |
| - <img src="https://avatars.githubusercontent.com/u/27347476?s=64&v=4" alt="@dependabot" size="32" height="32" width="32" data-view-component="true" class="avatar"> |
115 |
| - </a> |
116 |
| - </li> |
117 |
| - <li style="margin-bottom:8px; margin-right:8px"> |
118 |
| - <a href="https://github.com/zomkd" class="" data-hovercard-type="user" data-hovercard-url="/users/zomkd/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self"> |
119 |
| - <img src="https://avatars.githubusercontent.com/u/92479660?s=64&v=4" alt="@zomkd" size="32" height="32" width="32" data-view-component="true" class="avatar circle"> |
120 |
| - </a> |
121 |
| - </li> |
122 |
| -</ul> |
123 |
| -<div style="margin-top: 8px; color: rgb(125, 133, 144)" > |
124 |
| - deka, dependabot, and zomkd |
125 |
| - </div> |
0 commit comments