30 lines
577 B
Vue
30 lines
577 B
Vue
<script setup>
|
|
import { Pie } from 'vue-chartjs'
|
|
import {
|
|
Chart as ChartJS,
|
|
Title,
|
|
Tooltip,
|
|
Legend,
|
|
ArcElement
|
|
} from 'chart.js'
|
|
|
|
ChartJS.register(Title, Tooltip, Legend, ArcElement)
|
|
|
|
const props = defineProps({
|
|
chartData: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
chartOptions: {
|
|
type: Object,
|
|
default: () => ({ responsive: true, maintainAspectRatio: false })
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="pie-chart-wrapper" style="position: relative; width:100%; height:300px;">
|
|
<Pie :data="chartData" :options="chartOptions" />
|
|
</div>
|
|
</template>
|