[FIX] Make chart labels better readable for darker themes

This commit is contained in:
Peter Pfeufer 2024-10-21 05:35:22 +02:00
parent 4210b2eabc
commit c0f0f8db73
No known key found for this signature in database

View File

@ -147,6 +147,8 @@
}); });
// Initialize empty Pie chart // Initialize empty Pie chart
const elementBody = document.querySelector('body');
const elementBodyCss = getComputedStyle(elementBody);
const ctx = document.getElementById('pieChart').getContext('2d'); const ctx = document.getElementById('pieChart').getContext('2d');
const pieChart = new Chart(ctx, { const pieChart = new Chart(ctx, {
type: 'pie', type: 'pie',
@ -180,6 +182,8 @@
} }
}); });
Chart.defaults.color = elementBodyCss.color;
// AJAX call to dynamically update the chart // AJAX call to dynamically update the chart
$.ajax({ $.ajax({
url: '{% url "mumble:release_pie_chart_data" %}', // Your Django view URL that returns chart data url: '{% url "mumble:release_pie_chart_data" %}', // Your Django view URL that returns chart data