From 792ce901fe98307414965f015f2558e48aa648f4 Mon Sep 17 00:00:00 2001 From: Szymon Pachucki Date: Sun, 24 Aug 2025 14:29:35 +0200 Subject: [PATCH 1/2] fix: axisLabel.formatter does not receive indexs when using customValues --- src/coord/axisTickLabelBuilder.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coord/axisTickLabelBuilder.ts b/src/coord/axisTickLabelBuilder.ts index 1ca67f5558..a6166d3d62 100644 --- a/src/coord/axisTickLabelBuilder.ts +++ b/src/coord/axisTickLabelBuilder.ts @@ -132,8 +132,10 @@ export function createAxisLabels(axis: Axis, ctx: AxisLabelsComputingContext): { return { labels: zrUtil.map(ticks, numval => { const tick = {value: numval}; + const index = ticks.indexOf(numval); + return { - formattedLabel: labelFormatter(tick), + formattedLabel: labelFormatter(tick, index), rawLabel: axis.scale.getLabel(tick), tickValue: numval, time: undefined as ScaleTick['time'] | NullUndefined, From e192f497bb5f32b48beb9769f369d411ba20cb4d Mon Sep 17 00:00:00 2001 From: Szymon Pachucki Date: Tue, 2 Sep 2025 20:17:11 +0200 Subject: [PATCH 2/2] test: added a test case --- test/axisLabel.html | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/test/axisLabel.html b/test/axisLabel.html index 16a08effb4..f50a7cb00f 100644 --- a/test/axisLabel.html +++ b/test/axisLabel.html @@ -46,6 +46,7 @@
+
+ +