<template>
    <div class="w-full">
        <canvas id="chart"></canvas>
    </div>
</template>
<script setup>
import { Chart } from 'chart.js/auto';
const props = defineProps({
    title: {
        type: String,
        default: ''
    },
    labels: {
        type: Array,
        default: () => []
    },
    data: {
        type: Array,
        default: () => []
    }
})
onMounted(() => {
    new Chart(document.getElementById('chart'), {
        type: 'line',
        data: {
            labels: props.labels,
            datasets: [
                {
                    label: props.title,
                    data: props.data
                }
            ]
        }
    })
})
</script>
