Merge pull request #13795 from dataease/pr@dev-v2@chart-extremum-fix
Some checks are pending
Typos Check / Spell Check with Typos (push) Waiting to run

fix(图表): 修复显示最值勾选后,如果切换其他视图仍然会显示的问题 #13215
This commit is contained in:
jianneng-fit2cloud 2024-12-04 00:07:14 +08:00 committed by GitHub
commit 6fa9795b1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -917,6 +917,7 @@ const onTypeChange = (render, type) => {
view.value.render = render
view.value.type = type
emitter.emit('chart-type-change')
emitter.emit('chart-type-change-' + view.value.id)
//
const chartViewInstance = chartViewManager.getChartView(view.value.render, view.value.type)
if (chartViewInstance) {

View File

@ -54,6 +54,7 @@ import { viewFieldTimeTrans } from '@/utils/viewUtils'
import { CHART_TYPE_CONFIGS } from '@/views/chart/components/editor/util/chart'
import request from '@/config/axios'
import { store } from '@/store'
import { clearExtremum } from '@/views/chart/components/js/extremumUitl'
const { wsCache } = useCache()
const chartComponent = ref<any>()
@ -138,8 +139,7 @@ const props = defineProps({
}
})
const dynamicAreaId = ref('')
const { view, showPosition, element, active, searchCount, scale } = toRefs(props)
const { view, showPosition, element, active, searchCount, scale, suffixId } = toRefs(props)
const titleShow = computed(() => {
return (
!['rich-text', 'picture-group'].includes(element.value.innerType) &&
@ -816,6 +816,15 @@ onMounted(() => {
initTitle()
}
})
useEmitt({
name: 'chart-type-change-' + view.value.id,
callback: () => {
const chart = cloneDeep(view.value)
chart.container =
'container-' + showPosition.value + '-' + view.value.id + '-' + suffixId.value
clearExtremum(chart)
}
})
const { refreshViewEnable, refreshUnit, refreshTime } = view.value
buildInnerRefreshTimer(refreshViewEnable, refreshUnit, refreshTime)