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 CHANGED
@@ -23,7 +23,7 @@ npm install apexsankey
23
23
  ## Usage
24
24
 
25
25
  ```js
26
- import ApexSankey from "apexsankey";
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 | Default | Description |
55
- | ------------------ | -------------------------- | --------------------------------------------------------------------------------- |
56
- | width | 800 | The width of graph container |
57
- | height | 800 | The height of graph container |
58
- | canvasStyle | None | The css styles for canvas root container |
59
- | spacing | 100 | The spacing from top and left of graph container |
60
- | nodeWidth | 20 | The width of graph nodes |
61
- | nodeBorderWidth | 1 | The border width of the nodes in pixels |
62
- | nodeBorderColor | none | The border color of the nodes |
63
- | onNodeClick | empty function | The callback function for node click. Node object will be parameter for callback. |
64
- | edgeOpacity | 0.4 | The opacity value for edges. Values must be between 0 to 1 and in fraction. |
65
- | edgeGradientFill | true | Enable gradient fill based on source and target node colors. |
66
- | enableTooltip | false | Enable tooltip on hover of nodes |
67
- | enableToolbar | false | Enable/disable graph toolbar
68
- | tooltipId | `sankey-tooltip-container` | The tooltip HTML element id |
69
- | tooltipTemplate | tooltipTemplate | The HTML template for tooltip |
70
- | tooltipBorderColor | `#BCBCBC` | The border color of tooltip |
71
- | tooltipBGColor | `#FFFFFF` | The background color of tooltip |
72
- | fontSize | `14px` | The size of font of nodes |
73
- | fontFamily | None | The font family of nodes |
74
- | fontWeight | 400 | The font weight of nodes |
75
- | fontColor | `#000000` | The font color of nodes |
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: "a",
145
- title: "AAA",
159
+ id: 'a',
160
+ title: 'AAA',
146
161
  },
147
162
  {
148
- id: "b",
149
- title: "BBB",
163
+ id: 'b',
164
+ title: 'BBB',
150
165
  },
151
166
  {
152
- id: "c",
153
- title: "CCC",
167
+ id: 'c',
168
+ title: 'CCC',
154
169
  },
155
170
  ],
156
171
  edges: [
157
172
  {
158
- source: "a",
159
- target: "c",
173
+ source: 'a',
174
+ target: 'c',
160
175
  value: 1,
161
- type: "A",
176
+ type: 'A',
162
177
  },
163
178
  {
164
- source: "b",
165
- target: "c",
179
+ source: 'b',
180
+ target: 'c',
166
181
  value: 2,
167
- type: "A",
182
+ type: 'A',
168
183
  },
169
184
  ],
170
185
  options: {
171
- order: [[["a", "b"]], [["c"]]],
186
+ order: [[['a', 'b']], [['c']]],
172
187
  },
173
188
  };
174
189
  ```