Skip to content

Commit

Permalink
CSS & tri départements 🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlaine committed Oct 18, 2023
1 parent c757d03 commit c646cc6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
6 changes: 4 additions & 2 deletions client/components/stats/DepartementTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const props = defineProps<{
}>();
const headers = ['N° Département', 'Nombre recherches', '% recherches'];
const rows = [];
let rows: any[] = [];
const query: Ref<string> = ref('');
const rowsFiltered: Ref<any[]> = ref([]);
const componentKey = ref(0);
Expand All @@ -17,7 +17,7 @@ const sumSearches = Object.values(props.stats.departementRepartition).reduce((a:
Object.keys(props.stats.departementRepartition).forEach((d: any) => {
rows.push([d, `${utils.numberWithSpaces(props.stats.departementRepartition[d])}`, `${(props.stats.departementRepartition[d] * 100 / sumSearches).toFixed(2)}%`]);
});
rowsFiltered.value = [...rows];
rows = rows.sort(new Intl.Collator(undefined, {numeric: true, sensitivity: 'base'}).compare)
function checkKeyboardNav($event) {
if (['search', 'Enter'].includes($event.key)) {
Expand All @@ -31,6 +31,8 @@ function filterDepartments() {
});
componentKey.value += 1;
}
filterDepartments()
</script>

<template>
Expand Down
6 changes: 0 additions & 6 deletions client/components/stats/LineChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,14 @@ const chartLineData = {
datasets: [
{
label: 'Visiteurs',
backgroundColor: '#000091',
borderColor: '#000091',
data: props.stats.statsByDay.map((s: any) => s.visits)
},
{
label: 'Recherche de restrictions',
backgroundColor: '#c9191e',
borderColor: '#c9191e',
data: props.stats.statsByDay.map((s: any) => s.restrictionsSearch)
},
{
label: 'Téléchargement d\'arrêtés',
backgroundColor: '#18753c',
borderColor: '#18753c',
data: props.stats.statsByDay.map((s: any) => s.arreteDownloads)
}
]
Expand Down
1 change: 0 additions & 1 deletion client/components/stats/ProfileRepartition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const props = defineProps<{
const chartePieData = {
labels: Object.values(Profile),
datasets: [{
backgroundColor: ['#000091', '#c9191e', '#18753c', '#FEB24C'],
data: []
}]
};
Expand Down
3 changes: 0 additions & 3 deletions client/layouts/basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const mandatoryLinks: any[] = [{
}, {
label: 'Cookies',
to: '/cookies',
}, {
label: 'Statistiques',
to: '/statistiques',
}];
const ecosystemLinks: any[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
PointElement,
LineController,
TimeScale,
ArcElement
ArcElement,
Colors
} from 'chart.js';
import 'chartjs-adapter-luxon';
import api from "../../api";
Expand All @@ -28,7 +29,7 @@ useHead({
const links: Ref<any[]> = ref([{"to": "/", "text": "Accueil"}, {"text": "Statistiques"}])
ChartJS.register(Title, Tooltip, Legend, LineElement, CategoryScale, LinearScale, PointElement, LineController, TimeScale, ArcElement)
ChartJS.register(Title, Tooltip, Legend, LineElement, CategoryScale, LinearScale, PointElement, LineController, TimeScale, ArcElement, Colors)
const {data, error} = await api.getStats();
</script>
Expand Down

0 comments on commit c646cc6

Please sign in to comment.