apexsankey 1.2.4 → 1.3.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 +51 -38
- package/apexsankey.es.min.js +1035 -5876
- package/apexsankey.min.js +1 -9
- package/demo/basic-sankey.html +30 -39
- package/index.d.ts +4 -1
- package/lib/layout/rankAssignment/makeAcyclic.d.ts +1 -1
- package/lib/models/Graph.d.ts +2 -0
- package/lib/models/Paper.d.ts +3 -1
- package/lib/sankey.d.ts +7 -4
- package/package.json +3 -19
- package/.husky/commit-msg +0 -1
- package/.husky/pre-push +0 -1
- package/commitlint.config.js +0 -5
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,46 @@ 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
|
-
| enableTooltip
|
|
67
|
-
| enableToolbar
|
|
68
|
-
| tooltipId
|
|
69
|
-
| tooltipTemplate
|
|
70
|
-
| tooltipBorderColor | `#BCBCBC`
|
|
71
|
-
| tooltipBGColor
|
|
72
|
-
| fontSize
|
|
73
|
-
| fontFamily
|
|
74
|
-
| fontWeight
|
|
75
|
-
| fontColor
|
|
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
|
+
| enableTooltip | false | Enable tooltip on hover of nodes |
|
|
81
|
+
| enableToolbar | false | Enable/disable graph toolbar |
|
|
82
|
+
| tooltipId | `sankey-tooltip-container` | The tooltip HTML element id |
|
|
83
|
+
| tooltipTemplate | tooltipTemplate | The HTML template for tooltip |
|
|
84
|
+
| tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
|
|
85
|
+
| tooltipBGColor | `#FFFFFF` | The background color of tooltip |
|
|
86
|
+
| fontSize | `14px` | The size of font of nodes |
|
|
87
|
+
| fontFamily | None | The font family of nodes |
|
|
88
|
+
| fontWeight | 400 | The font weight of nodes |
|
|
89
|
+
| fontColor | `#000000` | The font color of nodes |
|
|
76
90
|
|
|
77
91
|
Default tooltip template
|
|
78
92
|
|
|
@@ -121,8 +135,7 @@ Passed data should be an object containing nodes, edges and options. Nodes, edge
|
|
|
121
135
|
|
|
122
136
|
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
137
|
|
|
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,
|
|
138
|
+
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
139
|
|
|
127
140
|
```json
|
|
128
141
|
{
|
|
@@ -141,34 +154,34 @@ Passed data should be an object containing nodes, edges and options. Nodes, edge
|
|
|
141
154
|
const data = {
|
|
142
155
|
nodes: [
|
|
143
156
|
{
|
|
144
|
-
id:
|
|
145
|
-
title:
|
|
157
|
+
id: 'a',
|
|
158
|
+
title: 'AAA',
|
|
146
159
|
},
|
|
147
160
|
{
|
|
148
|
-
id:
|
|
149
|
-
title:
|
|
161
|
+
id: 'b',
|
|
162
|
+
title: 'BBB',
|
|
150
163
|
},
|
|
151
164
|
{
|
|
152
|
-
id:
|
|
153
|
-
title:
|
|
165
|
+
id: 'c',
|
|
166
|
+
title: 'CCC',
|
|
154
167
|
},
|
|
155
168
|
],
|
|
156
169
|
edges: [
|
|
157
170
|
{
|
|
158
|
-
source:
|
|
159
|
-
target:
|
|
171
|
+
source: 'a',
|
|
172
|
+
target: 'c',
|
|
160
173
|
value: 1,
|
|
161
|
-
type:
|
|
174
|
+
type: 'A',
|
|
162
175
|
},
|
|
163
176
|
{
|
|
164
|
-
source:
|
|
165
|
-
target:
|
|
177
|
+
source: 'b',
|
|
178
|
+
target: 'c',
|
|
166
179
|
value: 2,
|
|
167
|
-
type:
|
|
180
|
+
type: 'A',
|
|
168
181
|
},
|
|
169
182
|
],
|
|
170
183
|
options: {
|
|
171
|
-
order: [[[
|
|
184
|
+
order: [[['a', 'b']], [['c']]],
|
|
172
185
|
},
|
|
173
186
|
};
|
|
174
187
|
```
|