Skip to content

Commit 4379789

Browse files
authored
Merge pull request #20218 from semla/aria-exclude-columns
feat(aria): allows excluding data in aria-label
2 parents ce500cf + b1a2374 commit 4379789

File tree

3 files changed

+103
-2
lines changed

3 files changed

+103
-2
lines changed

src/util/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,8 @@ export interface AriaLabelOption {
17331733
separator?: {
17341734
middle?: string;
17351735
end?: string;
1736-
}
1736+
},
1737+
excludeDimensionId?: number[]
17371738
}
17381739
}
17391740

src/visual/aria.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,14 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
218218

219219
const middleSeparator = labelModel.get(['data', 'separator', 'middle']);
220220
const endSeparator = labelModel.get(['data', 'separator', 'end']);
221+
const excludeDimensionId = labelModel.get(['data', 'excludeDimensionId']);
221222
const dataLabels = [];
222223
for (let i = 0; i < data.count(); i++) {
223224
if (i < maxDataCnt) {
224225
const name = data.getName(i);
225-
const value = data.getValues(i);
226+
const value = !excludeDimensionId ? data.getValues(i)
227+
: zrUtil.filter(data.getValues(i), (v, j) =>
228+
zrUtil.indexOf(excludeDimensionId, j) === -1);
226229
const dataLabel = labelModel.get(['data', name ? 'withName' : 'withoutName']);
227230
dataLabels.push(
228231
replace(dataLabel, {

test/ut/spec/series/aria-columns-exclude.test.ts

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)