From 28c7e4920006ad0a73f6ebaed6e0b38c96b379b3 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio Date: Thu, 21 Nov 2024 11:38:20 -0600 Subject: [PATCH] Fix chart --- main.go | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/main.go b/main.go index fe9b783..83cf0c7 100644 --- a/main.go +++ b/main.go @@ -955,6 +955,7 @@ func getTemplateContent(name string) string { async function createChart() { const data = await fetchData(); const ctx = document.getElementById('seederStatsChart').getContext('2d'); + Chart.defaults.color = "#fff"; new Chart(ctx, { type: 'line', @@ -964,24 +965,24 @@ func getTemplateContent(name string) string { { label: '<4 seeders', data: data.map((d) => d.lowSeedersTB), - backgroundColor: 'rgba(255, 99, 132, 0.7)', - borderColor: 'rgba(255, 99, 132, 1)', + backgroundColor: '#f5c2e7', + borderColor: '#f5c2e7', fill: true, order: 3 }, { label: '4-10 seeders', data: data.map((d) => d.mediumSeedersTB), - backgroundColor: 'rgba(255, 206, 86, 0.7)', - borderColor: 'rgba(255, 206, 86, 1)', + backgroundColor: '#f9e2af', + borderColor: '#f9e2af', fill: true, order: 2 }, { label: '>10 seeders', data: data.map((d) => d.highSeedersTB), - backgroundColor: 'rgba(75, 192, 192, 0.7)', - borderColor: 'rgba(75, 192, 192, 1)', + backgroundColor: '#74c7ec', + borderColor: '#74c7ec', fill: true, order: 1 } @@ -994,43 +995,47 @@ func getTemplateContent(name string) string { type: 'category', title: { display: true, - text: 'Date' - } + text: 'Date', + }, }, y: { stacked: true, title: { display: true, - text: 'Terabytes' + text: 'Terabytes', }, ticks: { callback: function(value) { - return value + 'TB'; - } - } - } + return value + 'TB' + }, + }, + }, }, plugins: { title: { display: true, text: 'Daily Seeder Stats' + font: { + size: 30, + family: 'JetBrains Mono, monospace' + } }, legend: { display: true, - position: 'top' + position: 'top', }, tooltip: { mode: 'index', - intersect: false - } + intersect: false, + }, }, interaction: { mode: 'nearest', axis: 'x', - intersect: false - } - } - }); + intersect: false, + }, + }, + }) } createChart();