Skip to content

Commit

Permalink
Merge pull request #20218 from semla/aria-exclude-columns
Browse files Browse the repository at this point in the history
feat(aria): allows excluding data in aria-label
  • Loading branch information
Ovilia authored Aug 5, 2024
2 parents ce500cf + b1a2374 commit 4379789
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,8 @@ export interface AriaLabelOption {
separator?: {
middle?: string;
end?: string;
}
},
excludeDimensionId?: number[]
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/visual/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,14 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {

const middleSeparator = labelModel.get(['data', 'separator', 'middle']);
const endSeparator = labelModel.get(['data', 'separator', 'end']);
const excludeDimensionId = labelModel.get(['data', 'excludeDimensionId']);
const dataLabels = [];
for (let i = 0; i < data.count(); i++) {
if (i < maxDataCnt) {
const name = data.getName(i);
const value = data.getValues(i);
const value = !excludeDimensionId ? data.getValues(i)
: zrUtil.filter(data.getValues(i), (v, j) =>
zrUtil.indexOf(excludeDimensionId, j) === -1);
const dataLabel = labelModel.get(['data', name ? 'withName' : 'withoutName']);
dataLabels.push(
replace(dataLabel, {
Expand Down
97 changes: 97 additions & 0 deletions test/ut/spec/series/aria-columns-exclude.test.ts

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

0 comments on commit 4379789

Please sign in to comment.