Merge branch 'fix-mumble-chart-font-color' into 'master'

[FIX] Make chart labels better readable for darker themes

See merge request allianceauth/allianceauth!1659
This commit is contained in:
Ariel Rin 2024-10-22 02:14:36 +00:00
commit fd66a7cb20

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