apexsankey 1.2.5 → 1.4.0
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 +53 -38
- package/apexsankey.es.min.js +6217 -11254
- package/apexsankey.min.js +1 -9
- package/lib/layout/edgeOrdering/orderEdges.d.ts +3 -3
- package/lib/layout/layout.d.ts +6 -6
- package/lib/layout/nodePositioning/justified.d.ts +2 -2
- package/lib/layout/rankAssignment/makeAcyclic.d.ts +1 -1
- package/lib/models/ColorPalette.d.ts +3 -0
- package/lib/models/Graph.d.ts +2 -0
- package/lib/models/Options.d.ts +5 -1
- package/lib/models/Paper.d.ts +3 -1
- package/lib/sankey.d.ts +5 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npm install apexsankey
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
|
-
import ApexSankey from
|
|
26
|
+
import ApexSankey from 'apexsankey';
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
To create a basic sankey with minimal configuration, write as follows:
|
|
@@ -47,32 +47,48 @@ To create a basic sankey with minimal configuration, write as follows:
|
|
|
47
47
|
const graph = sankey.render(data);
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## Setting the License
|
|
51
|
+
|
|
52
|
+
To use ApexSankey with a commercial license, set your license key before creating any chart instances:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import ApexSankey from 'apexsankey';
|
|
56
|
+
|
|
57
|
+
// set license key before creating any charts
|
|
58
|
+
ApexSankey.setLicense('your-license-key');
|
|
59
|
+
|
|
60
|
+
const sankey = new ApexSankey(document.getElementById('sankey-container'), options);
|
|
61
|
+
const graph = sankey.render(data);
|
|
62
|
+
```
|
|
63
|
+
|
|
50
64
|
## ApexSankey Options
|
|
51
65
|
|
|
52
66
|
The layout can be configured by either setting the properties in the table below by passing a second arg to ApexSankey with these properties set. The latter takes precedence.
|
|
53
67
|
|
|
54
|
-
| Options
|
|
55
|
-
|
|
|
56
|
-
| width
|
|
57
|
-
| height
|
|
58
|
-
| canvasStyle
|
|
59
|
-
| spacing
|
|
60
|
-
| nodeWidth
|
|
61
|
-
| nodeBorderWidth
|
|
62
|
-
| nodeBorderColor
|
|
63
|
-
| onNodeClick
|
|
64
|
-
| edgeOpacity
|
|
65
|
-
| edgeGradientFill
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
68
|
+
| Options | Default | Description |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| width | 800 | The width of graph container |
|
|
71
|
+
| height | 800 | The height of graph container |
|
|
72
|
+
| canvasStyle | None | The css styles for canvas root container |
|
|
73
|
+
| spacing | 100 | The spacing from top and left of graph container |
|
|
74
|
+
| nodeWidth | 20 | The width of graph nodes |
|
|
75
|
+
| nodeBorderWidth | 1 | The border width of the nodes in pixels |
|
|
76
|
+
| nodeBorderColor | none | The border color of the nodes |
|
|
77
|
+
| onNodeClick | empty function | The callback function for node click. Node object will be parameter for callback. |
|
|
78
|
+
| edgeOpacity | 0.4 | The opacity value for edges. Values must be between 0 to 1 and in fraction. |
|
|
79
|
+
| edgeGradientFill | true | Enable gradient fill based on source and target node colors. |
|
|
80
|
+
| edgeGap | 2 | The gap in pixels between edges at node connection points. |
|
|
81
|
+
| whitespace | 0.25 | Fraction of vertical space used for margins between nodes (0-1). Lower values make nodes taller. |
|
|
82
|
+
| enableTooltip | false | Enable tooltip on hover of nodes |
|
|
83
|
+
| enableToolbar | false | Enable/disable graph toolbar |
|
|
84
|
+
| tooltipId | `sankey-tooltip-container` | The tooltip HTML element id |
|
|
85
|
+
| tooltipTemplate | tooltipTemplate | The HTML template for tooltip |
|
|
86
|
+
| tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
|
|
87
|
+
| tooltipBGColor | `#FFFFFF` | The background color of tooltip |
|
|
88
|
+
| fontSize | `14px` | The size of font of nodes |
|
|
89
|
+
| fontFamily | None | The font family of nodes |
|
|
90
|
+
| fontWeight | 400 | The font weight of nodes |
|
|
91
|
+
| fontColor | `#000000` | The font color of nodes |
|
|
76
92
|
|
|
77
93
|
Default tooltip template
|
|
78
94
|
|
|
@@ -121,8 +137,7 @@ Passed data should be an object containing nodes, edges and options. Nodes, edge
|
|
|
121
137
|
|
|
122
138
|
If order is not specified, the nodes are automatically assigned to layers. If order is specified, it is used directly and no rank assignment or ordering algorithm takes place.
|
|
123
139
|
|
|
124
|
-
The order structure has three nested lists: order is a list of layers, each of which is a list of bands, each of which is a list of node ids.
|
|
125
|
-
For example,
|
|
140
|
+
The order structure has three nested lists: order is a list of layers, each of which is a list of bands, each of which is a list of node ids. For example,
|
|
126
141
|
|
|
127
142
|
```json
|
|
128
143
|
{
|
|
@@ -141,34 +156,34 @@ Passed data should be an object containing nodes, edges and options. Nodes, edge
|
|
|
141
156
|
const data = {
|
|
142
157
|
nodes: [
|
|
143
158
|
{
|
|
144
|
-
id:
|
|
145
|
-
title:
|
|
159
|
+
id: 'a',
|
|
160
|
+
title: 'AAA',
|
|
146
161
|
},
|
|
147
162
|
{
|
|
148
|
-
id:
|
|
149
|
-
title:
|
|
163
|
+
id: 'b',
|
|
164
|
+
title: 'BBB',
|
|
150
165
|
},
|
|
151
166
|
{
|
|
152
|
-
id:
|
|
153
|
-
title:
|
|
167
|
+
id: 'c',
|
|
168
|
+
title: 'CCC',
|
|
154
169
|
},
|
|
155
170
|
],
|
|
156
171
|
edges: [
|
|
157
172
|
{
|
|
158
|
-
source:
|
|
159
|
-
target:
|
|
173
|
+
source: 'a',
|
|
174
|
+
target: 'c',
|
|
160
175
|
value: 1,
|
|
161
|
-
type:
|
|
176
|
+
type: 'A',
|
|
162
177
|
},
|
|
163
178
|
{
|
|
164
|
-
source:
|
|
165
|
-
target:
|
|
179
|
+
source: 'b',
|
|
180
|
+
target: 'c',
|
|
166
181
|
value: 2,
|
|
167
|
-
type:
|
|
182
|
+
type: 'A',
|
|
168
183
|
},
|
|
169
184
|
],
|
|
170
185
|
options: {
|
|
171
|
-
order: [[[
|
|
186
|
+
order: [[['a', 'b']], [['c']]],
|
|
172
187
|
},
|
|
173
188
|
};
|
|
174
189
|
```
|