Skip to content

Commit b53f490

Browse files
committed
fix: fix axis label font family (#623)
1 parent 8977629 commit b53f490

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/util/echarts.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
ToolboxComponentOption,
1212
VisualMapComponentOption,
1313
} from "echarts"
14+
import type { AxisBaseOption } from 'echarts/types/src/coord/axisCommonTypes.js'
1415
import { isRtl } from "./document"
1516

1617
export const processAria = (option: ComposeOption<AriaComponentOption>, chartDecal: boolean) => {
@@ -73,7 +74,7 @@ type GlobalEcOption = ComposeOption<
7374

7475
export const processFont = (toProcess: unknown, elFont: string) => {
7576
const options = toProcess as GlobalEcOption
76-
const { series, title, legend } = options
77+
const { series, title, legend, xAxis, yAxis } = options
7778
processArrayLike(title, t => {
7879
t.textStyle = {
7980
...t.textStyle,
@@ -96,6 +97,15 @@ export const processFont = (toProcess: unknown, elFont: string) => {
9697
fontFamily: l.textStyle?.fontFamily ?? elFont,
9798
}
9899
})
100+
processArrayLike(xAxis, a => processAxisFont(a, elFont))
101+
processArrayLike(yAxis, a => processAxisFont(a, elFont))
102+
}
103+
104+
const processAxisFont = (a: AxisBaseOption, elFont: string) => {
105+
a.axisLabel = {
106+
...a.axisLabel,
107+
fontFamily: a.axisLabel?.fontFamily ?? elFont,
108+
}
99109
}
100110

101111
export const processRtl = (toProcess: unknown) => {

0 commit comments

Comments
 (0)