2022-01-14 22:07:02 +08:00
|
|
|
<template>
|
2022-03-23 20:41:50 +08:00
|
|
|
<v-chart :theme="themeColor" :option="option" autoresize></v-chart>
|
2022-01-14 22:07:02 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-02-02 18:17:45 +08:00
|
|
|
import { computed, PropType } from 'vue'
|
|
|
|
import VChart from 'vue-echarts'
|
2022-03-20 18:11:26 +08:00
|
|
|
import { use } from 'echarts/core'
|
2022-02-02 18:17:45 +08:00
|
|
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
|
|
import { PieChart } from 'echarts/charts'
|
2022-02-21 21:16:44 +08:00
|
|
|
import { mergeTheme } from '@/packages/public/chart'
|
2022-02-24 17:23:20 +08:00
|
|
|
import config, { includes } from './config'
|
2022-02-02 18:17:45 +08:00
|
|
|
import {
|
2022-03-20 18:11:26 +08:00
|
|
|
DatasetComponent,
|
2022-02-02 18:17:45 +08:00
|
|
|
GridComponent,
|
|
|
|
TooltipComponent,
|
2022-02-21 19:45:11 +08:00
|
|
|
LegendComponent,
|
2022-02-02 18:17:45 +08:00
|
|
|
} from 'echarts/components'
|
2022-01-14 22:07:02 +08:00
|
|
|
|
2022-02-02 18:17:45 +08:00
|
|
|
const props = defineProps({
|
2022-02-21 19:45:11 +08:00
|
|
|
themeSetting: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
themeColor: {
|
|
|
|
type: Object,
|
2022-02-06 01:04:05 +08:00
|
|
|
required: true
|
|
|
|
},
|
2022-02-24 17:23:20 +08:00
|
|
|
chartConfig: {
|
2022-02-02 18:17:45 +08:00
|
|
|
type: Object as PropType<config>,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
})
|
2022-01-14 22:07:02 +08:00
|
|
|
|
2022-02-02 18:17:45 +08:00
|
|
|
use([
|
2022-03-20 18:11:26 +08:00
|
|
|
DatasetComponent,
|
2022-02-02 18:17:45 +08:00
|
|
|
CanvasRenderer,
|
|
|
|
PieChart,
|
|
|
|
GridComponent,
|
|
|
|
TooltipComponent,
|
2022-02-21 19:45:11 +08:00
|
|
|
LegendComponent,
|
2022-02-02 18:17:45 +08:00
|
|
|
])
|
2022-01-14 22:07:02 +08:00
|
|
|
|
2022-02-21 21:16:44 +08:00
|
|
|
|
2022-02-02 18:17:45 +08:00
|
|
|
const option = computed(() => {
|
2022-02-24 17:23:20 +08:00
|
|
|
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
2022-02-02 18:17:45 +08:00
|
|
|
})
|
|
|
|
</script>
|