boussole-pluss/frontend/components/PolarAreaChart.vue

81 lines
1.4 KiB
Vue
Raw Permalink Normal View History

<script lang="ts" setup>
import {PolarArea} from 'vue-chartjs';
import type {PropType} from "vue";
2022-10-07 14:15:53 +00:00
const props = defineProps({
data: {
type: Object as PropType<number[]>
2022-10-07 14:15:53 +00:00
}
});
2022-10-07 14:15:53 +00:00
const chartData = computed(() => {
return {
2022-10-07 14:15:53 +00:00
labels: [
2023-02-28 16:36:17 +00:00
"1. Pouvoir d'agir",
"2. Multi-secteur",
"3. Local global",
"4. Utilité (sociale et écologique)",
"5. Communs",
"6. Démocratie",
"7. Coopération",
"8. Finances",
"9. Moyens de production",
"10. Travail"
2022-10-07 14:15:53 +00:00
],
datasets: [
{
backgroundColor: [
"#CA8AE8",
"#22B9A6",
"#E7E145",
"#F39345",
"#9FCC8B",
"#FDA6C5",
"#7E91F1",
"#F37665",
"#E9D280",
"#7BD1F5"
],
data: props.data,
2022-10-07 14:15:53 +00:00
borderWidth: 1,
borderColor: "#666666"
}
]
};
});
2022-10-07 14:15:53 +00:00
const chartOptions = ref({
responsive: true,
maintainAspectRatio: true,
scales: {
r: {
suggestedMin: 0,
suggestedMax: 10,
ticks: {
2022-10-07 14:15:53 +00:00
display: false
}
}
},
plugins: {
legend: {
display: false
}
2022-10-07 14:15:53 +00:00
}
})
2022-10-07 14:15:53 +00:00
</script>
<template>
<div class="chart-container">
<polar-area
:options="chartOptions"
:data="chartData"
/>
</div>
</template>
<style lang="scss" scoped>
.chart-container {
position: relative;
max-width: 60vh;
}
</style>