From 29a6ced7dd4d30726c0427a153a83fd507db004a Mon Sep 17 00:00:00 2001 From: jianneng-fit2cloud Date: Thu, 16 May 2024 18:47:42 +0800 Subject: [PATCH] =?UTF-8?q?style(=E5=9B=BE=E8=A1=A8-=E8=B1=A1=E9=99=90?= =?UTF-8?q?=E5=9B=BE):=20=E6=A0=B7=E5=BC=8F=E4=B8=AD=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=9A=84=E4=BA=A4=E4=BA=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/QuadrantSelector.vue | 372 ++++++++++++------ .../js/panel/charts/others/quadrant.ts | 5 - 2 files changed, 241 insertions(+), 136 deletions(-) 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 }