diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/QuadrantSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/QuadrantSelector.vue index aa1e548edc..139861dc0c 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/QuadrantSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/QuadrantSelector.vue @@ -3,13 +3,16 @@ import { computed, inject, onMounted, PropType, reactive, ref, watch } from 'vue import { useI18n } from '@/hooks/web/useI18n' import { COLOR_PANEL, DEFAULT_QUADRANT_STYLE } from '@/views/chart/components/editor/util/chart' import { useEmitt } from '@/hooks/web/useEmitt' +import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' +import { storeToRefs } from 'pinia' +import { deepCopy } from '@/utils/utils' useEmitt({ name: 'quadrant-default-baseline', callback: args => quadrantDefaultBaseline(args) }) const quotaData = ref(inject('quotaData')) const { t } = useI18n() - +const dvMainStore = dvMainStoreWithOut() const props = defineProps({ chart: { type: Object, @@ -25,9 +28,29 @@ const props = defineProps({ }) const predefineColors = COLOR_PANEL - +const regionStyle = [] +const labels = [] +const isDashboard = dvMainStore.dvInfo.type === 'dashboard' +for (let i = 0; i < 4; i++) { + regionStyle.push({ + fill: isDashboard ? '#fdfcfc' : 'rgb(2,4,8,1)', + fillOpacity: 1 + }) + labels.push({ + content: '', + style: { + fill: isDashboard ? 'rgb(2,4,8,1)' : '#fdfcfc', + fillOpacity: 0.5, + fontSize: 14 + } + }) +} const state = reactive({ - quadrantForm: JSON.parse(JSON.stringify(DEFAULT_QUADRANT_STYLE)) + quadrantForm: { + ...JSON.parse(JSON.stringify(DEFAULT_QUADRANT_STYLE)), + regionStyle, + labels + } }) const toolTip = computed(() => { return props.themes === 'dark' ? 'ndark' : 'dark' @@ -84,19 +107,27 @@ const init = () => { } if (customAttr.quadrant) { state.quadrantForm = customAttr.quadrant + } else { + changeStyle() } } } const showProperty = prop => props.propertyInner?.includes(prop) - +const tabActive = ref(1) onMounted(() => { init() }) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts index 4c4d1c9a2e..815c2b4ec6 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/quadrant.ts @@ -7,10 +7,8 @@ import { flow, parseJson } from '../../../util' import { valueFormatter } from '../../../formatter' import { useI18n } from '@/hooks/web/useI18n' import { isEmpty } from 'lodash-es' -import { DEFAULT_QUADRANT_STYLE } from '@/views/chart/components/editor/util/chart' const { t } = useI18n() - /** * 象限图 */ @@ -396,9 +394,6 @@ export class Quadrant extends G2PlotChartView { ...chart.customStyle.yAxisExt.axisLine, show: true } - chart.customAttr.quadrant = { - ...DEFAULT_QUADRANT_STYLE - } return chart }