diff --git a/src/component/axis/AxisBuilder.ts b/src/component/axis/AxisBuilder.ts index f0653691c1..5ed1ed3f6b 100644 --- a/src/component/axis/AxisBuilder.ts +++ b/src/component/axis/AxisBuilder.ts @@ -46,6 +46,8 @@ type AxisEventData = { targetType: 'axisName' | 'axisLabel' name?: string value?: string | number + dataIndex?: number + tickIndex?: number } & { [key in AxisIndexKey]?: number }; @@ -814,6 +816,10 @@ function buildAxisLabel( const eventData = AxisBuilder.makeAxisEventDataBase(axisModel); eventData.targetType = 'axisLabel'; eventData.value = rawLabel; + eventData.tickIndex = index; + if (axis.type === 'category') { + eventData.dataIndex = tickValue; + } getECData(textEl).eventData = eventData; } diff --git a/test/axisLabel.html b/test/axisLabel.html index c8cb8bc9f0..a3c5b97971 100644 --- a/test/axisLabel.html +++ b/test/axisLabel.html @@ -27,7 +27,7 @@ - + @@ -315,10 +315,6 @@