From d124d6fcee615dde79477efb26139cc369b15e81 Mon Sep 17 00:00:00 2001 From: ulleo Date: Mon, 2 Dec 2024 11:32:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E6=8D=A2=E5=AD=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #13408 --- core/core-frontend/src/models/chart/chart.d.ts | 2 ++ .../src/views/chart/components/js/panel/charts/line/line.ts | 1 - .../views/chart/components/js/panel/common/common_antv.ts | 5 +++++ .../components/views/components/ChartComponentG2Plot.vue | 3 ++- .../core-frontend/src/views/chart/components/views/index.vue | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/models/chart/chart.d.ts b/core/core-frontend/src/models/chart/chart.d.ts index 4f3fbfc1a0..6fc1a5f7f3 100644 --- a/core/core-frontend/src/models/chart/chart.d.ts +++ b/core/core-frontend/src/models/chart/chart.d.ts @@ -73,6 +73,8 @@ declare interface Chart { showPosition: string extColor: Axis[] + + fontFamily?: string } declare type CustomAttr = DeepPartial | JSONString> declare type CustomStyle = DeepPartial | JSONString> diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/line/line.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/line/line.ts index 210897f500..2b632a9f7c 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/line/line.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/line/line.ts @@ -358,7 +358,6 @@ export class Line extends G2PlotChartView { fill: style.stroke } } - console.log(optionTmp) return optionTmp } protected setupOptions(chart: Chart, options: LineOptions): LineOptions { diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts index ed51500ae8..1de4ff9ec3 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts @@ -146,6 +146,11 @@ export function getTheme(chart: Chart) { } } } + if (chart.fontFamily) { + theme.styleSheet = { + fontFamily: chart.fontFamily + } + } return theme } // 通用label diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue index 0986d6581f..1d029e91b7 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue @@ -225,7 +225,8 @@ const renderChart = async (view, callback?) => { // 与默认图表对象合并,方便增加配置项 const chart = deepCopy({ ...defaultsDeep(view, cloneDeep(BASE_VIEW_CONFIG)), - data: chartData.value + data: chartData.value, + fontFamily: props.fontFamily }) const chartView = chartViewManager.getChartView(view.render, view.type) recursionTransObj(customAttrTrans, chart.customAttr, scale.value, terminal.value) diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index e5dc8e94b3..a7e1026ee9 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -1151,6 +1151,7 @@ const titleTooltipWidth = computed(() => { :show-position="showPosition" :element="element" :suffixId="suffixId" + :font-family="fontFamily" v-else-if=" showChartView(ChartLibraryType.G2_PLOT, ChartLibraryType.L7_PLOT, ChartLibraryType.L7) " @@ -1167,6 +1168,7 @@ const titleTooltipWidth = computed(() => { :show-position="showPosition" :element="element" :drill-length="drillClickLength" + :font-family="fontFamily" v-else-if="showChartView(ChartLibraryType.S2)" ref="chartComponent" @onPointClick="onPointClick"