Commit 05e7a444df81a27df3cd4f3210d6d34f74b739d5

Authored by fengwotao
1 parent f51d6c53

feat(src/packages): 图表双折线支持导入多个数据源

... ... @@ -3,7 +3,7 @@
3 3 ref="vChartRef"
4 4 :init-options="initOptions"
5 5 :theme="themeColor"
6   - :option="option.value"
  6 + :option="option"
7 7 :manual-update="isPreview()"
8 8 autoresize
9 9 :update-options="{
... ... @@ -15,7 +15,7 @@
15 15 </template>
16 16
17 17 <script setup lang="ts">
18   -import { reactive, watch, PropType, onMounted, ref, nextTick } from 'vue'
  18 +import { reactive, watch, PropType, onMounted, ref, nextTick,computed } from 'vue'
19 19 import VChart from 'vue-echarts'
20 20 import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
21 21 import { use, graphic } from 'echarts/core'
... ... @@ -52,8 +52,8 @@ const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSe
52 52 use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
53 53 const chartEditStore = useChartEditStore()
54 54
55   -const option = reactive({
56   - value: {}
  55 +const option = computed(() => {
  56 + return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
57 57 })
58 58 const toolBoxOption = {
59 59 show: true,
... ... @@ -99,7 +99,7 @@ watch(
99 99 ])
100 100 })
101 101 }
102   - option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
  102 + // option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
103 103 props.chartConfig.option = option.value
104 104 } catch (error) {
105 105 console.log(error)
... ... @@ -205,7 +205,7 @@ watch(
205 205 () => props.chartConfig.option.dataset,
206 206 (newData: { dimensions: any }, oldData) => {
207 207 try {
208   - option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
  208 + // option.value = mergeTheme(props.chartConfig.option, props.themeSetting, includes)
209 209 if (!isObject(newData) || !('dimensions' in newData)) return
210 210 if (Array.isArray(newData?.dimensions)) {
211 211 const seriesArr = []
... ...