fix: 完成数据监控,更新图表

This commit is contained in:
tnt group 2022-09-07 11:22:13 +08:00
parent 9c0f1f793f
commit 5763ff0d57
2 changed files with 21 additions and 3 deletions

View File

@ -10,6 +10,6 @@ export const RadarConfig: ConfigType = {
category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS,
chartFrame: ChartFrameEnum.COMMON,
image
}

View File

@ -3,7 +3,7 @@
</template>
<script setup lang="ts">
import { computed, PropType } from 'vue'
import { computed, PropType, watch } from 'vue'
import VChart from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
@ -37,5 +37,23 @@ const option = computed(() => {
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
})
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
const dataSetHandle = (dataset: any) => {
props.chartConfig.option.legend.data = dataset.seriesData.map(i => i.name)
props.chartConfig.option.radar.indicator = dataset.radarIndicator
props.chartConfig.option.series[0].data = dataset.seriesData
}
watch(
() => props.chartConfig.option.dataset,
newData => {
dataSetHandle(newData)
},
{
immediate: true
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
dataSetHandle(newData)
})
</script>