mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
add more possible colors to graphs (#819)
This commit is contained in:
parent
9705a34c5c
commit
585fd07859
1 changed files with 9 additions and 1 deletions
|
|
@ -201,9 +201,17 @@
|
|||
window.chartInstances[elementId].destroy();
|
||||
}
|
||||
const ctx = canvas.getContext("2d");
|
||||
const pieColors = [
|
||||
'#60a5fa', '#f472b6', '#fb923c', '#facc15', '#4ade80',
|
||||
'#2dd4bf', '#a78bfa', '#f87171', '#38bdf8', '#e879f9',
|
||||
'#34d399', '#fbbf24', '#818cf8', '#fb7185', '#22d3ee',
|
||||
'#a3e635', '#c084fc', '#f97316', '#14b8a6', '#8b5cf6',
|
||||
'#ec4899', '#84cc16', '#06b6d4', '#d946ef', '#10b981'
|
||||
];
|
||||
const backgroundColors = labels.map((_, i) => pieColors[i % pieColors.length]);
|
||||
window.chartInstances[elementId] = new Chart(ctx, {
|
||||
type: "pie",
|
||||
data: { labels, datasets: [{data, borderWidth: 1 }] },
|
||||
data: { labels, datasets: [{data, backgroundColor: backgroundColors, borderWidth: 1 }] },
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue