You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-56Lines changed: 11 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,12 @@
15
15
16
16
You can also load different data sets and configurations via URL query parameter. Below is a table with all the data sets available in the live sandbox for you to interactively explore different kinds of integrations with the library.
| small |[see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=small)|`sandbox/data/small`| This is a good example to get you started. It has only 4 nodes. It's good to discuss over integration details and it's also good to report issues that you might found in the library. It's much easier to debug over a tiny graph. |
21
-
| custom-node|[see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=custom-node)|`sandbox/data/custom-node`| In this example you'll be able to see the power of the feature [node.viewGenerator](https://danielcaldas.github.io/react-d3-graph/docs/#node-view-generator) to create highly customizable nodes for you graph that go beyond the simple shapes that come out of the box with the library. |
22
-
| marvel |[see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=marvel)|`sandbox/data/marvel`| In this thematic example you can see how several features such as: [nodeHighlightBehavior](https://danielcaldas.github.io/react-d3-graph/docs/#node-highlight-behavior), [custom SVGs for nodes](https://danielcaldas.github.io/react-d3-graph/docs/#node-svg), [collapsible](https://danielcaldas.github.io/react-d3-graph/docs/#collapsible) etc. come together on top of a directed graph that displays some characters from the Marvel Universe. |
23
-
| static |[see it in action](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=static)|`sandbox/data/static`| If your goal is not to have nodes dancing around with the default [d3 forces](https://danielcaldas.github.io/react-d3-graph/docs/#config-d3) that the library provides, you can opt by making your nodes static and positioned them always in the same _(x, y)_ coordinates. To achieve this you can make use of [staticGraphWithDragAndDrop](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph-with-drag-and-drop) or [staticGraph](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph)|
| small |[demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=small)|`sandbox/data/small`| This is a good example to get you started. It has only 4 nodes. It's good to discuss over integration details and it's also good to report issues that you might found in the library. It's much easier to debug over a tiny graph. |
21
+
| custom |[demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=custom-node)|`sandbox/data/custom-node`| In this example you'll be able to see the power of the feature [node.viewGenerator](https://danielcaldas.github.io/react-d3-graph/docs/#node-view-generator) to create highly customizable nodes for you graph that go beyond the simple shapes that come out of the box with the library. |
22
+
| marvel |[demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=marvel)|`sandbox/data/marvel`| In this thematic example you can see how several features such as: [nodeHighlightBehavior](https://danielcaldas.github.io/react-d3-graph/docs/#node-highlight-behavior), [custom SVGs for nodes](https://danielcaldas.github.io/react-d3-graph/docs/#node-svg), [collapsible](https://danielcaldas.github.io/react-d3-graph/docs/#collapsible) etc. come together on top of a directed graph that displays some characters from the Marvel Universe. |
23
+
| static |[demo](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html?data=static)|`sandbox/data/static`| If your goal is not to have nodes dancing around with the default [d3 forces](https://danielcaldas.github.io/react-d3-graph/docs/#config-d3) that the library provides, you can opt by making your nodes static and positioned them always in the same _(x, y)_ coordinates. To achieve this you can make use of [staticGraphWithDragAndDrop](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph-with-drag-and-drop) or [staticGraph](https://danielcaldas.github.io/react-d3-graph/docs/#static-graph)|
24
24
25
25
Do you want to visualize your own data set on the live sandbox? Just submit a PR! You're welcome 😁.
26
26
@@ -46,7 +46,7 @@ npm install react-d3-graph
46
46
> npm WARN [email protected] requires a peer of d3@^5.5.0 but none is installed. You must install peer dependencies yourself.
47
47
> npm WARN [email protected] requires a peer of react@^16.4.1 but none is installed. You must install peer dependencies yourself.
48
48
49
-
## Usage sample
49
+
## Minimal usage example
50
50
51
51
Graph component is the main component for react-d3-graph components, its interface allows its user to build the graph once the user provides the data, configuration (optional) and callback interactions (also optional).
52
52
The code for the [live example](https://danielcaldas.github.io/react-d3-graph/sandbox/index.html) can be consulted [here](https://github.com/danielcaldas/react-d3-graph/blob/master/sandbox/Sandbox.jsx).
@@ -63,8 +63,7 @@ const data = {
63
63
],
64
64
};
65
65
66
-
// the graph configuration, you only need to pass down properties
67
-
// that you want to override, otherwise default ones will be used
66
+
// the graph configuration, just override the ones you need
68
67
constmyConfig= {
69
68
nodeHighlightBehavior:true,
70
69
node: {
@@ -77,69 +76,25 @@ const myConfig = {
77
76
},
78
77
};
79
78
80
-
// graph event callbacks
81
-
constonClickGraph=function() {
82
-
window.alert(`Clicked the graph background`);
83
-
};
84
-
85
79
constonClickNode=function(nodeId) {
86
80
window.alert(`Clicked node ${nodeId}`);
87
81
};
88
82
89
-
constonDoubleClickNode=function(nodeId) {
90
-
window.alert(`Double clicked node ${nodeId}`);
91
-
};
92
-
93
-
constonRightClickNode=function(event, nodeId) {
94
-
window.alert(`Right clicked node ${nodeId}`);
95
-
};
96
-
97
-
constonMouseOverNode=function(nodeId) {
98
-
window.alert(`Mouse over node ${nodeId}`);
99
-
};
100
-
101
-
constonMouseOutNode=function(nodeId) {
102
-
window.alert(`Mouse out node ${nodeId}`);
103
-
};
104
-
105
83
constonClickLink=function(source, target) {
106
84
window.alert(`Clicked link between ${source} and ${target}`);
0 commit comments