chartjs-chart-sankey 0.12.1 → 0.14.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/LICENSE +1 -1
- package/README.md +9 -2
- package/dist/chartjs-chart-sankey.esm.js +775 -859
- package/dist/chartjs-chart-sankey.js +774 -858
- package/dist/chartjs-chart-sankey.min.js +2 -2
- package/package.json +33 -22
- package/types/index.esm.d.ts +71 -46
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[Chart.js](https://www.chartjs.org/) **^3.3** module for creating sankey diagrams
|
|
4
4
|
|
|
5
|
+

|
|
6
|
+
[](https://sonarcloud.io/summary/new_code?id=kurkle_chartjs-chart-sankey)
|
|
7
|
+
[](https://sonarcloud.io/summary/new_code?id=kurkle_chartjs-chart-sankey)
|
|
5
8
|
[](https://www.npmjs.com/package/chartjs-chart-sankey)
|
|
6
9
|
[](https://github.com/kurkle/chartjs-chart-sankey/releases/latest)
|
|
7
|
-

|
|
8
10
|

|
|
9
11
|

|
|
10
12
|
|
|
@@ -56,6 +58,7 @@ const colors = {
|
|
|
56
58
|
d: 'gray'
|
|
57
59
|
};
|
|
58
60
|
|
|
61
|
+
const getHover = (key) => colors[key];
|
|
59
62
|
const getColor = (key) => colors[key];
|
|
60
63
|
|
|
61
64
|
const chart = new Chart(ctx, {
|
|
@@ -71,7 +74,11 @@ const chart = new Chart(ctx, {
|
|
|
71
74
|
],
|
|
72
75
|
colorFrom: (c) => getColor(c.dataset.data[c.dataIndex].from),
|
|
73
76
|
colorTo: (c) => getColor(c.dataset.data[c.dataIndex].to),
|
|
77
|
+
hoverColorFrom: (c) => getHover(c.dataset.data[c.dataIndex].from),
|
|
78
|
+
hoverColorTo: (c) => getHover(c.dataset.data[c.dataIndex].to),
|
|
74
79
|
colorMode: 'gradient', // or 'from' or 'to'
|
|
80
|
+
/* optionally override default alpha (0.5) applied to colorFrom and colorTo */
|
|
81
|
+
alpha: 1,
|
|
75
82
|
/* optional labels */
|
|
76
83
|
labels: {
|
|
77
84
|
a: 'Label A',
|
|
@@ -127,7 +134,7 @@ const chart = new Chart(ctx, {
|
|
|
127
134
|
|
|
128
135
|
## Example
|
|
129
136
|
|
|
130
|
-

|
|
131
138
|
|
|
132
139
|
## Online examples
|
|
133
140
|
|