<template>
  <v-chart :loading="loading" class="chart" :option="option" />
</template>

<script setup>
import { use } from 'echarts/core'
import { BarChart, PieChart } from 'echarts/charts'
import {
  TitleComponent,
  TooltipComponent,
  LegendComponent,
  GridComponent,
  DataZoomComponent,
} from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'

use([
  TitleComponent,
  TooltipComponent,
  LegendComponent,
  GridComponent,
  BarChart,
  CanvasRenderer,
  PieChart,
  DataZoomComponent,
])

import VChart, { THEME_KEY } from 'vue-echarts'

import { provide } from 'vue'

provide(THEME_KEY, 'white')

defineProps({
  option: {
    type: Object,
    required: true,
  },
  loading: {
    type: Boolean,
    default: true,
  },
})
</script>

<style lang="scss" scoped>
.chart {
  width: 100%;
  height: 100%;
}
</style>
