|
|
@@ -3,7 +3,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { computed, PropType } from 'vue'
|
|
|
+import { computed, PropType, reactive, watch } from 'vue'
|
|
|
import VChart from 'vue-echarts'
|
|
|
import { use } from 'echarts/core'
|
|
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
|
@@ -13,12 +13,7 @@ import config, { includes } from './config'
|
|
|
import { useChartDataFetch } from '@/hooks'
|
|
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
|
|
import { isPreview } from '@/utils'
|
|
|
-import {
|
|
|
- DatasetComponent,
|
|
|
- GridComponent,
|
|
|
- TooltipComponent,
|
|
|
- LegendComponent,
|
|
|
-} from 'echarts/components'
|
|
|
+import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
|
|
|
|
|
|
const props = defineProps({
|
|
|
themeSetting: {
|
|
|
@@ -35,19 +30,28 @@ const props = defineProps({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-use([
|
|
|
- DatasetComponent,
|
|
|
- CanvasRenderer,
|
|
|
- PieChart,
|
|
|
- GridComponent,
|
|
|
- TooltipComponent,
|
|
|
- LegendComponent,
|
|
|
-])
|
|
|
-
|
|
|
+use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent])
|
|
|
|
|
|
const option = computed(() => {
|
|
|
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
|
|
})
|
|
|
|
|
|
+watch(
|
|
|
+ () => props.chartConfig.option.type,
|
|
|
+ newData => {
|
|
|
+ if (newData === 'nomal') {
|
|
|
+ props.chartConfig.option.series[0].radius = '70%'
|
|
|
+ props.chartConfig.option.series[0].roseType = false
|
|
|
+ } else if (newData === 'ring') {
|
|
|
+ props.chartConfig.option.series[0].radius = ['40%', '65%']
|
|
|
+ props.chartConfig.option.series[0].roseType = false
|
|
|
+ } else {
|
|
|
+ props.chartConfig.option.series[0].radius = '70%'
|
|
|
+ props.chartConfig.option.series[0].roseType = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { deep: true, immediate: true }
|
|
|
+)
|
|
|
+
|
|
|
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
|
|
</script>
|