mirror of
https://gitee.com/dromara/go-view.git
synced 2025-05-13 06:31:34 +08:00
51 lines
1.1 KiB
Vue
51 lines
1.1 KiB
Vue
<template>
|
|
<v-chart :theme="themeColor" :option="option" autoresize></v-chart>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, PropType } from 'vue'
|
|
import VChart from 'vue-echarts'
|
|
import { use } from 'echarts/core'
|
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
import { BarChart } from 'echarts/charts'
|
|
import { mergeTheme } from '@/packages/public/chart'
|
|
import config, { includes } from './config'
|
|
import { useChartDataFetch } from '@/hooks/useChartDataFetch.hook'
|
|
import {
|
|
DatasetComponent,
|
|
GridComponent,
|
|
TooltipComponent,
|
|
LegendComponent,
|
|
} from 'echarts/components'
|
|
|
|
const props = defineProps({
|
|
themeSetting: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
themeColor: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
chartConfig: {
|
|
type: Object as PropType<config>,
|
|
required: true
|
|
}
|
|
})
|
|
|
|
use([
|
|
DatasetComponent,
|
|
CanvasRenderer,
|
|
BarChart,
|
|
GridComponent,
|
|
TooltipComponent,
|
|
LegendComponent,
|
|
])
|
|
|
|
const option = computed(() => {
|
|
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
|
})
|
|
|
|
useChartDataFetch(props.chartConfig)
|
|
</script>
|