chartjs-plugin-autocolors 0.0.3 → 0.0.6
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 +51 -34
- package/dist/chartjs-plugin-autocolors.esm.js +77 -73
- package/dist/chartjs-plugin-autocolors.js +79 -75
- package/dist/chartjs-plugin-autocolors.min.js +5 -5
- package/package.json +10 -11
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -54,10 +54,10 @@ Single chart
|
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
56
|
const chart = new Chart(ctx, {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
// ...
|
|
58
|
+
plugins: [
|
|
59
|
+
autocolors
|
|
60
|
+
]
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -67,14 +67,14 @@ If registered globally, it might be desirable to disable the autocolors for some
|
|
|
67
67
|
|
|
68
68
|
```js
|
|
69
69
|
const chart = new Chart(ctx, {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
// ...
|
|
71
|
+
options: {
|
|
72
|
+
plugins: {
|
|
73
|
+
autocolors: {
|
|
74
|
+
enabled: false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
78
|
});
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -87,14 +87,14 @@ There are two modes, `'dataset'` (default) and `'data'`
|
|
|
87
87
|
|
|
88
88
|
```js
|
|
89
89
|
const chart = new Chart(ctx, {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
// ...
|
|
91
|
+
options: {
|
|
92
|
+
plugins: {
|
|
93
|
+
autocolors: {
|
|
94
|
+
mode: 'data'
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
98
|
});
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -108,20 +108,37 @@ with values acceptable as colors by Chart.js.
|
|
|
108
108
|
const lighten = (color, value) => Chart.helpers.color(color).lighten(value).rgbString();
|
|
109
109
|
|
|
110
110
|
const chart = new Chart(ctx, {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
111
|
+
// ...
|
|
112
|
+
options: {
|
|
113
|
+
plugins: {
|
|
114
|
+
autocolors: {
|
|
115
|
+
customize(context) {
|
|
116
|
+
const colors = context.colors;
|
|
117
|
+
return {
|
|
118
|
+
background: lighten(colors.background, 0.5),
|
|
119
|
+
border: lighten(colors.border, 0.5)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Offset
|
|
129
|
+
|
|
130
|
+
`offset` option can be used to offset the color generation by a number of colors.
|
|
131
|
+
|
|
132
|
+
```js
|
|
133
|
+
const chart = new Chart(ctx, {
|
|
134
|
+
// ...
|
|
135
|
+
options: {
|
|
136
|
+
plugins: {
|
|
137
|
+
autocolors: {
|
|
138
|
+
offset: 5
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
125
142
|
});
|
|
126
143
|
```
|
|
127
144
|
|
|
@@ -1,113 +1,117 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.6
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
7
|
/*!
|
|
8
|
-
* @kurkle/color v0.1
|
|
8
|
+
* @kurkle/color v0.2.1
|
|
9
9
|
* https://github.com/kurkle/color#readme
|
|
10
|
-
* (c)
|
|
10
|
+
* (c) 2022 Jukka Kurkela
|
|
11
11
|
* Released under the MIT License
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
function round(v) {
|
|
15
|
-
|
|
14
|
+
return v + 0.5 | 0;
|
|
16
15
|
}
|
|
17
16
|
const lim = (v, l, h) => Math.max(Math.min(v, h), l);
|
|
18
17
|
function n2b(v) {
|
|
19
|
-
|
|
18
|
+
return lim(round(v * 255), 0, 255);
|
|
20
19
|
}
|
|
21
20
|
function b2n(v) {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
function rgbString(v) {
|
|
25
|
-
return v && (
|
|
26
|
-
v.a < 255
|
|
27
|
-
? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`
|
|
28
|
-
: `rgb(${v.r}, ${v.g}, ${v.b})`
|
|
29
|
-
);
|
|
21
|
+
return lim(round(v / 2.55) / 100, 0, 1);
|
|
30
22
|
}
|
|
31
23
|
function hsv2rgbn(h, s, v) {
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
25
|
+
return [f(5), f(3), f(1)];
|
|
34
26
|
}
|
|
35
27
|
function calln(f, a, b, c) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
return (
|
|
29
|
+
Array.isArray(a)
|
|
30
|
+
? f(a[0], a[1], a[2])
|
|
31
|
+
: f(a, b, c)
|
|
32
|
+
).map(n2b);
|
|
41
33
|
}
|
|
42
34
|
function hsv2rgb(h, s, v) {
|
|
43
|
-
|
|
35
|
+
return calln(hsv2rgbn, h, s, v);
|
|
36
|
+
}
|
|
37
|
+
function rgbString(v) {
|
|
38
|
+
return v && (
|
|
39
|
+
v.a < 255
|
|
40
|
+
? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`
|
|
41
|
+
: `rgb(${v.r}, ${v.g}, ${v.b})`
|
|
42
|
+
);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
function* hueGen() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
yield 0;
|
|
47
|
+
for (let i = 1; i < 10; i++) {
|
|
48
|
+
const d = 1 << i;
|
|
49
|
+
for (let j = 1; j <= d; j += 2) {
|
|
50
|
+
yield j / d;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
function* colorGen() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
const hue = hueGen();
|
|
57
|
+
let h = hue.next();
|
|
58
|
+
while (!h.done) {
|
|
59
|
+
let rgb = hsv2rgb(Math.round(h.value * 360), 0.6, 0.8);
|
|
60
|
+
yield {background: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 192}), border: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 144})};
|
|
61
|
+
rgb = hsv2rgb(Math.round(h.value * 360), 0.6, 0.5);
|
|
62
|
+
yield {background: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 192}), border: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 144})};
|
|
63
|
+
h = hue.next();
|
|
64
|
+
}
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
function setColors(dataset, background, border) {
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
dataset.backgroundColor = dataset.backgroundColor || background;
|
|
69
|
+
dataset.borderColor = dataset.borderColor || border;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
function getNext(color, customize, context) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
const c = color.next().value;
|
|
74
|
+
if (typeof customize === 'function') {
|
|
75
|
+
return customize(Object.assign({colors: c}, context));
|
|
76
|
+
}
|
|
77
|
+
return c;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
var index = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
id: 'autocolors',
|
|
82
|
+
beforeUpdate(chart, args, options) {
|
|
83
|
+
const {mode = 'dataset', enabled = true, customize} = options;
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
if (!enabled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
const color = colorGen();
|
|
90
|
+
if (options.offset) {
|
|
91
|
+
for (let i = 0; i < options.offset; i++) {
|
|
92
|
+
color.next();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
96
|
+
for (const dataset of chart.data.datasets) {
|
|
97
|
+
if (dataset.backgroundColor && dataset.borderColor) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (mode === 'dataset') {
|
|
101
|
+
const c = getNext(color, customize, {chart, datasetIndex: dataset.index});
|
|
102
|
+
setColors(dataset, c.background, c.border);
|
|
103
|
+
} else {
|
|
104
|
+
const background = [];
|
|
105
|
+
const border = [];
|
|
106
|
+
for (let i = 0; i < dataset.data.length; i++) {
|
|
107
|
+
const c = getNext(color, customize, {chart, datasetIndex: dataset.index, dataIndex: i});
|
|
108
|
+
background.push(c.background);
|
|
109
|
+
border.push(c.border);
|
|
110
|
+
}
|
|
111
|
+
setColors(dataset, background, border);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
111
115
|
};
|
|
112
116
|
|
|
113
|
-
export default
|
|
117
|
+
export { index as default };
|
|
@@ -1,121 +1,125 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.6
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
8
8
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
9
9
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
10
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global[
|
|
11
|
-
}(this, (function () { 'use strict';
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["chartjs-plugin-autocolors"] = factory());
|
|
11
|
+
})(this, (function () { 'use strict';
|
|
12
12
|
|
|
13
13
|
/*!
|
|
14
|
-
* @kurkle/color v0.1
|
|
14
|
+
* @kurkle/color v0.2.1
|
|
15
15
|
* https://github.com/kurkle/color#readme
|
|
16
|
-
* (c)
|
|
16
|
+
* (c) 2022 Jukka Kurkela
|
|
17
17
|
* Released under the MIT License
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
19
|
function round(v) {
|
|
21
|
-
|
|
20
|
+
return v + 0.5 | 0;
|
|
22
21
|
}
|
|
23
22
|
const lim = (v, l, h) => Math.max(Math.min(v, h), l);
|
|
24
23
|
function n2b(v) {
|
|
25
|
-
|
|
24
|
+
return lim(round(v * 255), 0, 255);
|
|
26
25
|
}
|
|
27
26
|
function b2n(v) {
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function rgbString(v) {
|
|
31
|
-
return v && (
|
|
32
|
-
v.a < 255
|
|
33
|
-
? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`
|
|
34
|
-
: `rgb(${v.r}, ${v.g}, ${v.b})`
|
|
35
|
-
);
|
|
27
|
+
return lim(round(v / 2.55) / 100, 0, 1);
|
|
36
28
|
}
|
|
37
29
|
function hsv2rgbn(h, s, v) {
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(Math.min(k, 4 - k, 1), 0);
|
|
31
|
+
return [f(5), f(3), f(1)];
|
|
40
32
|
}
|
|
41
33
|
function calln(f, a, b, c) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
return (
|
|
35
|
+
Array.isArray(a)
|
|
36
|
+
? f(a[0], a[1], a[2])
|
|
37
|
+
: f(a, b, c)
|
|
38
|
+
).map(n2b);
|
|
47
39
|
}
|
|
48
40
|
function hsv2rgb(h, s, v) {
|
|
49
|
-
|
|
41
|
+
return calln(hsv2rgbn, h, s, v);
|
|
42
|
+
}
|
|
43
|
+
function rgbString(v) {
|
|
44
|
+
return v && (
|
|
45
|
+
v.a < 255
|
|
46
|
+
? `rgba(${v.r}, ${v.g}, ${v.b}, ${b2n(v.a)})`
|
|
47
|
+
: `rgb(${v.r}, ${v.g}, ${v.b})`
|
|
48
|
+
);
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
function* hueGen() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
yield 0;
|
|
53
|
+
for (let i = 1; i < 10; i++) {
|
|
54
|
+
const d = 1 << i;
|
|
55
|
+
for (let j = 1; j <= d; j += 2) {
|
|
56
|
+
yield j / d;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
function* colorGen() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
const hue = hueGen();
|
|
63
|
+
let h = hue.next();
|
|
64
|
+
while (!h.done) {
|
|
65
|
+
let rgb = hsv2rgb(Math.round(h.value * 360), 0.6, 0.8);
|
|
66
|
+
yield {background: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 192}), border: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 144})};
|
|
67
|
+
rgb = hsv2rgb(Math.round(h.value * 360), 0.6, 0.5);
|
|
68
|
+
yield {background: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 192}), border: rgbString({r: rgb[0], g: rgb[1], b: rgb[2], a: 144})};
|
|
69
|
+
h = hue.next();
|
|
70
|
+
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
function setColors(dataset, background, border) {
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
dataset.backgroundColor = dataset.backgroundColor || background;
|
|
75
|
+
dataset.borderColor = dataset.borderColor || border;
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
function getNext(color, customize, context) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
const c = color.next().value;
|
|
80
|
+
if (typeof customize === 'function') {
|
|
81
|
+
return customize(Object.assign({colors: c}, context));
|
|
82
|
+
}
|
|
83
|
+
return c;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
var index = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
id: 'autocolors',
|
|
88
|
+
beforeUpdate(chart, args, options) {
|
|
89
|
+
const {mode = 'dataset', enabled = true, customize} = options;
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
if (!enabled) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
const color = colorGen();
|
|
96
|
+
if (options.offset) {
|
|
97
|
+
for (let i = 0; i < options.offset; i++) {
|
|
98
|
+
color.next();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
for (const dataset of chart.data.datasets) {
|
|
103
|
+
if (dataset.backgroundColor && dataset.borderColor) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (mode === 'dataset') {
|
|
107
|
+
const c = getNext(color, customize, {chart, datasetIndex: dataset.index});
|
|
108
|
+
setColors(dataset, c.background, c.border);
|
|
109
|
+
} else {
|
|
110
|
+
const background = [];
|
|
111
|
+
const border = [];
|
|
112
|
+
for (let i = 0; i < dataset.data.length; i++) {
|
|
113
|
+
const c = getNext(color, customize, {chart, datasetIndex: dataset.index, dataIndex: i});
|
|
114
|
+
background.push(c.background);
|
|
115
|
+
border.push(c.border);
|
|
116
|
+
}
|
|
117
|
+
setColors(dataset, background, border);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
117
121
|
};
|
|
118
122
|
|
|
119
123
|
return index;
|
|
120
124
|
|
|
121
|
-
}))
|
|
125
|
+
}));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.6
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
7
|
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(o="undefined"!=typeof globalThis?globalThis:o||self)["chartjs-plugin-autocolors"]=t()}(this,(function(){"use strict";
|
|
8
8
|
/*!
|
|
9
|
-
* @kurkle/color v0.1
|
|
9
|
+
* @kurkle/color v0.2.1
|
|
10
10
|
* https://github.com/kurkle/color#readme
|
|
11
|
-
* (c)
|
|
11
|
+
* (c) 2022 Jukka Kurkela
|
|
12
12
|
* Released under the MIT License
|
|
13
|
-
*/function o(o){return o+.5|0}const t=(o,t,n)=>Math.max(Math.min(o,n),t);function n(n){return t(o(255*n),0,255)}function e(
|
|
13
|
+
*/function o(o){return o+.5|0}const t=(o,t,n)=>Math.max(Math.min(o,n),t);function n(n){return t(o(255*n),0,255)}function e(o,t,n){const e=(e,r=(e+o/60)%6)=>n-n*t*Math.max(Math.min(r,4-r,1),0);return[e(5),e(3),e(1)]}function r(o,t,r){return a=e,d=o,u=t,c=r,(Array.isArray(d)?a(d[0],d[1],d[2]):a(d,u,c)).map(n);var a,d,u,c}function a(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${function(n){return t(o(n/2.55)/100,0,1)}(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}function d(o,t,n){o.backgroundColor=o.backgroundColor||t,o.borderColor=o.borderColor||n}function u(o,t,n){const e=o.next().value;return"function"==typeof t?t(Object.assign({colors:e},n)):e}return{id:"autocolors",beforeUpdate(o,t,n){const{mode:e="dataset",enabled:c=!0,customize:f}=n;if(!c)return;const i=function*(){const o=function*(){yield 0;for(let o=1;o<10;o++){const t=1<<o;for(let o=1;o<=t;o+=2)yield o/t}}();let t=o.next();for(;!t.done;){let n=r(Math.round(360*t.value),.6,.8);yield{background:a({r:n[0],g:n[1],b:n[2],a:192}),border:a({r:n[0],g:n[1],b:n[2],a:144})},n=r(Math.round(360*t.value),.6,.5),yield{background:a({r:n[0],g:n[1],b:n[2],a:192}),border:a({r:n[0],g:n[1],b:n[2],a:144})},t=o.next()}}();if(n.offset)for(let o=0;o<n.offset;o++)i.next();for(const t of o.data.datasets)if(!t.backgroundColor||!t.borderColor)if("dataset"===e){const n=u(i,f,{chart:o,datasetIndex:t.index});d(t,n.background,n.border)}else{const n=[],e=[];for(let r=0;r<t.data.length;r++){const a=u(i,f,{chart:o,datasetIndex:t.index,dataIndex:r});n.push(a.background),e.push(a.border)}d(t,n,e)}}}}));
|
|
14
14
|
//# sourceMappingURL=chartjs-plugin-autocolors.min.js.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chartjs-plugin-autocolors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Automatic color generation for Chart.js",
|
|
5
5
|
"main": "dist/chartjs-plugin-autocolors.js",
|
|
6
|
-
"module": "dist/chartjs-plugin-autocolors.
|
|
6
|
+
"module": "dist/chartjs-plugin-autocolors.esm.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rollup -c",
|
|
9
9
|
"lint": "eslint samples/**/*.html samples/**/*.js src/**/*.js **/*.md"
|
|
@@ -30,15 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/kurkle/chartjs-plugin-autocolors#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@kurkle/color": "^0.1
|
|
34
|
-
"@rollup/plugin-node-resolve": "^
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"eslint-config-chartjs": "^0.
|
|
37
|
-
"eslint-
|
|
38
|
-
"eslint-plugin-html": "^6.1.
|
|
39
|
-
"eslint-plugin-markdown": "^
|
|
33
|
+
"@kurkle/color": "^0.2.1",
|
|
34
|
+
"@rollup/plugin-node-resolve": "^13.0.4",
|
|
35
|
+
"eslint": "^8.17.0",
|
|
36
|
+
"eslint-config-chartjs": "^0.3.0",
|
|
37
|
+
"eslint-plugin-es": "^4.1.0",
|
|
38
|
+
"eslint-plugin-html": "^6.1.2",
|
|
39
|
+
"eslint-plugin-markdown": "^2.2.0",
|
|
40
40
|
"rollup": "^2.33.2",
|
|
41
41
|
"rollup-plugin-terser": "^7.0.2"
|
|
42
|
-
}
|
|
43
|
-
"dependencies": {}
|
|
42
|
+
}
|
|
44
43
|
}
|