chartjs-plugin-autocolors 0.0.6 → 0.0.7
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.7
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
4
|
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
@@ -86,10 +86,12 @@ var index = {
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
if (!chart._autocolor) {
|
|
90
|
+
chart._autocolor = colorGen();
|
|
91
|
+
if (options.offset) {
|
|
92
|
+
for (let i = 0; i < options.offset; i++) {
|
|
93
|
+
chart._autocolor.next();
|
|
94
|
+
}
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -98,13 +100,13 @@ var index = {
|
|
|
98
100
|
continue;
|
|
99
101
|
}
|
|
100
102
|
if (mode === 'dataset') {
|
|
101
|
-
const c = getNext(
|
|
103
|
+
const c = getNext(chart._autocolor, customize, {chart, datasetIndex: dataset.index});
|
|
102
104
|
setColors(dataset, c.background, c.border);
|
|
103
105
|
} else {
|
|
104
106
|
const background = [];
|
|
105
107
|
const border = [];
|
|
106
108
|
for (let i = 0; i < dataset.data.length; i++) {
|
|
107
|
-
const c = getNext(
|
|
109
|
+
const c = getNext(chart._autocolor, customize, {chart, datasetIndex: dataset.index, dataIndex: i});
|
|
108
110
|
background.push(c.background);
|
|
109
111
|
border.push(c.border);
|
|
110
112
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.7
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
4
|
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
@@ -92,10 +92,12 @@ var index = {
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
if (!chart._autocolor) {
|
|
96
|
+
chart._autocolor = colorGen();
|
|
97
|
+
if (options.offset) {
|
|
98
|
+
for (let i = 0; i < options.offset; i++) {
|
|
99
|
+
chart._autocolor.next();
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -104,13 +106,13 @@ var index = {
|
|
|
104
106
|
continue;
|
|
105
107
|
}
|
|
106
108
|
if (mode === 'dataset') {
|
|
107
|
-
const c = getNext(
|
|
109
|
+
const c = getNext(chart._autocolor, customize, {chart, datasetIndex: dataset.index});
|
|
108
110
|
setColors(dataset, c.background, c.border);
|
|
109
111
|
} else {
|
|
110
112
|
const background = [];
|
|
111
113
|
const border = [];
|
|
112
114
|
for (let i = 0; i < dataset.data.length; i++) {
|
|
113
|
-
const c = getNext(
|
|
115
|
+
const c = getNext(chart._autocolor, customize, {chart, datasetIndex: dataset.index, dataIndex: i});
|
|
114
116
|
background.push(c.background);
|
|
115
117
|
border.push(c.border);
|
|
116
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* chartjs-plugin-autocolors v0.0.
|
|
2
|
+
* chartjs-plugin-autocolors v0.0.7
|
|
3
3
|
* https://github.com/kurkle/chartjs-plugin-autocolors#readme
|
|
4
4
|
* (c) 2022 Jukka Kurkela
|
|
5
5
|
* Released under the MIT License
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* https://github.com/kurkle/color#readme
|
|
11
11
|
* (c) 2022 Jukka Kurkela
|
|
12
12
|
* Released under the MIT License
|
|
13
|
-
*/function o(o){return o+.5|0}const t=(o,t,
|
|
13
|
+
*/function o(o){return o+.5|0}const t=(o,t,r)=>Math.max(Math.min(o,r),t);function r(r){return t(o(255*r),0,255)}function e(o,t,r){const e=(e,n=(e+o/60)%6)=>r-r*t*Math.max(Math.min(n,4-n,1),0);return[e(5),e(3),e(1)]}function n(o,t,n){return a=e,u=o,d=t,c=n,(Array.isArray(u)?a(u[0],u[1],u[2]):a(u,d,c)).map(r);var a,u,d,c}function a(r){return r&&(r.a<255?`rgba(${r.r}, ${r.g}, ${r.b}, ${function(r){return t(o(r/2.55)/100,0,1)}(r.a)})`:`rgb(${r.r}, ${r.g}, ${r.b})`)}function u(o,t,r){o.backgroundColor=o.backgroundColor||t,o.borderColor=o.borderColor||r}function d(o,t,r){const e=o.next().value;return"function"==typeof t?t(Object.assign({colors:e},r)):e}return{id:"autocolors",beforeUpdate(o,t,r){const{mode:e="dataset",enabled:c=!0,customize:f}=r;if(c){if(!o._autocolor&&(o._autocolor=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 r=n(Math.round(360*t.value),.6,.8);yield{background:a({r:r[0],g:r[1],b:r[2],a:192}),border:a({r:r[0],g:r[1],b:r[2],a:144})},r=n(Math.round(360*t.value),.6,.5),yield{background:a({r:r[0],g:r[1],b:r[2],a:192}),border:a({r:r[0],g:r[1],b:r[2],a:144})},t=o.next()}}(),r.offset))for(let t=0;t<r.offset;t++)o._autocolor.next();for(const t of o.data.datasets)if(!t.backgroundColor||!t.borderColor)if("dataset"===e){const r=d(o._autocolor,f,{chart:o,datasetIndex:t.index});u(t,r.background,r.border)}else{const r=[],e=[];for(let n=0;n<t.data.length;n++){const a=d(o._autocolor,f,{chart:o,datasetIndex:t.index,dataIndex:n});r.push(a.background),e.push(a.border)}u(t,r,e)}}}}}));
|
|
14
14
|
//# sourceMappingURL=chartjs-plugin-autocolors.min.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chartjs-plugin-autocolors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Automatic color generation for Chart.js",
|
|
5
5
|
"main": "dist/chartjs-plugin-autocolors.js",
|
|
6
6
|
"module": "dist/chartjs-plugin-autocolors.esm.js",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"homepage": "https://github.com/kurkle/chartjs-plugin-autocolors#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@kurkle/color": "^0.2.1",
|
|
34
|
-
"@rollup/plugin-node-resolve": "^
|
|
34
|
+
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
35
35
|
"eslint": "^8.17.0",
|
|
36
36
|
"eslint-config-chartjs": "^0.3.0",
|
|
37
37
|
"eslint-plugin-es": "^4.1.0",
|
|
38
|
-
"eslint-plugin-html": "^
|
|
39
|
-
"eslint-plugin-markdown": "^
|
|
38
|
+
"eslint-plugin-html": "^7.1.0",
|
|
39
|
+
"eslint-plugin-markdown": "^3.0.0",
|
|
40
40
|
"rollup": "^2.33.2",
|
|
41
41
|
"rollup-plugin-terser": "^7.0.2"
|
|
42
42
|
}
|