We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41f5cb6 commit a160255Copy full SHA for a160255
src/main/resources/static/charts.js
@@ -78,17 +78,22 @@ function donutChart(objectName, data) {
78
});
79
80
function createColorArray(length) {
81
- let array = [];
82
- while (array.length < length) {
83
- array = array.concat([
84
- "#54ca76",
85
- "#f5c452",
86
- "#f2637f",
87
- "#9261f3",
88
- "#31a4e6",
89
- "#55cbcb",
90
- ]);
91
- }
+
+ const colors = [
+ "#54ca76",
+ "#f5c452",
+ "#f2637f",
+ "#9261f3",
+ "#31a4e6",
+ "#55cbcb"
+ ];
+ let array = [...Array(length).keys()].map(i => colors[i % colors.length]);
92
93
+ // avoid first and last colors being the same
94
+ if (length % colors.length === 1)
95
+ array[length - 1] = colors[1];
96
97
return array;
98
}
99
0 commit comments