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"