<script setup>
defineProps(['labels', 'datasets'])
import {ref} from 'vue';
import { Bar } from 'vue-chartjs';
import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale } from 'chart.js'
import { SessionUser } from "@/components/session/token/SessionUser.vue";


ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)

const chartOptions = {
  responsive: true,
  maintainAspectRatio: false
}

// Shortcut to statistics

// Set the time for the statistics to today
SessionUser.adminUser.statistics.set_time((new Date()).toISOString().split('T')[0], (new Date()).toISOString().split('T')[0])



</script>

<template>
  <div>
    <Bar
        id="statistics-bookings"
        :options="chartOptions"
        :data="{
          labels: labels,
          datasets: datasets
        }"
    />
  </div>
</template>