2022-01-15 22:35:32 +08:00
|
|
|
<template>
|
2022-03-28 15:44:55 +08:00
|
|
|
<v-chart
|
|
|
|
ref="vChartRef"
|
|
|
|
:theme="themeColor"
|
|
|
|
:option="option"
|
|
|
|
:manual-update="isPreview()"
|
|
|
|
autoresize
|
|
|
|
></v-chart>
|
2022-01-15 22:35:32 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-03-28 15:44:55 +08:00
|
|
|
import { computed, PropType } from 'vue'
|
|
|
|
import VChart from 'vue-echarts'
|
|
|
|
import { use } from 'echarts/core'
|
|
|
|
import 'echarts-liquidfill/src/liquidFill.js'
|
|
|
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
|
|
import { GridComponent } from 'echarts/components'
|
|
|
|
import { mergeTheme } from '@/packages/public/chart'
|
|
|
|
import config, { includes } from './config'
|
|
|
|
import { isPreview } from '@/utils'
|
2022-01-15 22:35:32 +08:00
|
|
|
|
2022-03-28 15:44:55 +08:00
|
|
|
const props = defineProps({
|
|
|
|
themeSetting: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
themeColor: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
chartConfig: {
|
|
|
|
type: Object as PropType<config>,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
use([CanvasRenderer, GridComponent])
|
2022-01-15 22:35:32 +08:00
|
|
|
|
2022-03-28 15:44:55 +08:00
|
|
|
const option = computed(() => {
|
|
|
|
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
|
|
|
})
|
|
|
|
</script>
|
2022-01-15 22:35:32 +08:00
|
|
|
|
2022-03-28 15:44:55 +08:00
|
|
|
<style lang="scss" scoped></style>
|