Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/main/resources/vue/components/_charts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@
});

function createColorArray(length) {
const colors = ["#54ca76", "#f5c452", "#f2637f", "#9261f3", "#31a4e6", "#55cbcb"];
let array = [...Array(length).keys()].map(i => colors[i % colors.length]);
// avoid first and last colors being the same
if (length % colors.length === 1) {
array[length - 1] = colors[1];
}
return array;
// golden-angle hue steps spread colors evenly around the wheel,
// so no two colors land close together, no matter how many languages there are
const GOLDEN_ANGLE = 137.508;
return [...Array(length).keys()].map(i => `hsl(${(i * GOLDEN_ANGLE) % 360}, 65%, 55%)`);
}

function arrayRotate(arr, n) {
Expand Down