fixing charts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Antoine M 2024-10-22 15:14:51 +02:00
parent 951f30e56e
commit 93819182f1
2 changed files with 14 additions and 24 deletions

View File

@ -14,20 +14,14 @@ function buildLevelDataCharts(level) {
}); });
} }
const colorPalettes = [ const colorPalettes = [
['#1d4ed8', '#3b82f6', '#60a5fa', '#93c5fd', '#c3dafe'], '#1240a1',
['#1d4ed8', '#3c67dc', '#5b81e0', '#7a9be3', '#99b5e7'], '#2e6ee0',
['#1223C2', '#030E8E', '#3D49C7', '#6D77D0'], '#548bf7',
['#1d4ed8', '#3b82f6', '#60a5fa', '#93c5fd', '#c3dafe'], '#81aefd',
['#1240a1', '#2e6ee0', '#548bf7', '#81aefd', '#a9d2ff'], '#a9d2ff',
['#0a37a8', '#2d65d4', '#5794ff', '#7dbdff', '#a3dcff'],
['#1a3d9c', '#4271d9', '#75a7ff', '#9fc5ff', '#c6e2ff'],
['#084ba6', '#3a79d6', '#6ba5ff', '#96c3ff', '#badbff'],
['#1137a3', '#3267d6', '#5fa3ff', '#8fc1ff', '#b5e0ff'],
]; ];
// console.log('score', scoreDistributionDataset);
new Chart( new Chart(
document.getElementById('graphic-score-repartition'), level.querySelector('.graphic-score-repartition'),
{ {
type: 'pie', type: 'pie',
data: { data: {
@ -36,7 +30,7 @@ function buildLevelDataCharts(level) {
), ),
datasets: [ datasets: [
{ {
backgroundColor: colorPalettes[4], backgroundColor: colorPalettes,
label: 'Nombres de joueurs', label: 'Nombres de joueurs',
data: scoreDistributionDataset.map( data: scoreDistributionDataset.map(
(row) => row.count (row) => row.count
@ -93,15 +87,11 @@ function buildRatingsDataChart() {
}); });
} }
const colorPalettes = [ const colorPalettes = [
['#1d4ed8', '#3b82f6', '#60a5fa', '#93c5fd', '#c3dafe'], '#1240a1',
['#1d4ed8', '#3c67dc', '#5b81e0', '#7a9be3', '#99b5e7'], '#2e6ee0',
['#1223C2', '#030E8E', '#3D49C7', '#6D77D0'], '#548bf7',
['#1d4ed8', '#3b82f6', '#60a5fa', '#93c5fd', '#c3dafe'], '#81aefd',
['#1240a1', '#2e6ee0', '#548bf7', '#81aefd', '#a9d2ff'], '#a9d2ff',
['#0a37a8', '#2d65d4', '#5794ff', '#7dbdff', '#a3dcff'],
['#1a3d9c', '#4271d9', '#75a7ff', '#9fc5ff', '#c6e2ff'],
['#084ba6', '#3a79d6', '#6ba5ff', '#96c3ff', '#badbff'],
['#1137a3', '#3267d6', '#5fa3ff', '#8fc1ff', '#b5e0ff'],
]; ];
// console.log('score', scoreDistributionDataset); // console.log('score', scoreDistributionDataset);
@ -115,7 +105,7 @@ function buildRatingsDataChart() {
), ),
datasets: [ datasets: [
{ {
backgroundColor: colorPalettes[4], backgroundColor: colorPalettes,
label: 'Nombres de joueurs', label: 'Nombres de joueurs',
data: ratingDistributionDataset.map( data: ratingDistributionDataset.map(
(row) => row.count (row) => row.count

View File

@ -75,7 +75,7 @@ $level_post_ids = $wpdb->get_col("
</div> </div>
<div class="game_stats__scores-distribution "> <div class="game_stats__scores-distribution ">
<h3>Répartition des scores</h3> <h3>Répartition des scores</h3>
<canvas id="graphic-score-repartition"></canvas> <canvas class="graphic-score-repartition"></canvas>
<ul> <ul>
<?php foreach ($notes_repartition as $note) : ?> <?php foreach ($notes_repartition as $note) : ?>