46 lines
960 B
Vue
Raw Normal View History

2022-01-15 21:05:11 +08:00
<template>
<VChart :theme="themeColor" :option="option" autoresize />
2022-01-15 21:05:11 +08:00
</template>
<script setup lang="ts">
import { computed, PropType } from 'vue'
import VChart from 'vue-echarts'
import { use, graphic } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts'
import config, { includes } from './config'
import { mergeTheme } from '@/packages/public/chart'
import {
GridComponent,
TooltipComponent,
LegendComponent,
} from 'echarts/components'
2022-01-15 21:05:11 +08:00
const props = defineProps({
themeSetting: {
type: Object,
required: true
},
themeColor: {
type: Object,
required: true
},
chartConfig: {
type: Object as PropType<config>,
required: true
}
})
2022-01-15 21:05:11 +08:00
use([
CanvasRenderer,
LineChart,
GridComponent,
TooltipComponent,
LegendComponent,
])
2022-01-15 21:05:11 +08:00
const option = computed(() => {
return mergeTheme( props.chartConfig.option, props.themeSetting, includes)
})
</script>