Skip to content

Commit

Permalink
feat: provide tickIndex and dataIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovilia committed Feb 28, 2022
1 parent 4f52057 commit 37b4286
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/component/axis/AxisBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type AxisEventData = {
name?: string
value?: string | number
dataIndex?: number
formattedLabel?: string
tickIndex?: number
} & {
[key in AxisIndexKey]?: number
};
Expand Down Expand Up @@ -816,8 +816,10 @@ function buildAxisLabel(
const eventData = AxisBuilder.makeAxisEventDataBase(axisModel);
eventData.targetType = 'axisLabel';
eventData.value = rawLabel;
eventData.dataIndex = index;
eventData.formattedLabel = formattedLabel;
eventData.tickIndex = index;
if (axis.type === 'category') {
eventData.dataIndex = index;
}

getECData(textEl).eventData = eventData;
}
Expand Down
3 changes: 2 additions & 1 deletion test/axisLabel.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 37b4286

Please sign in to comment.