Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(aria): allows excluding data in aria-label #20218

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor(aria): rename property to exclude
semla committed Aug 2, 2024
commit b1a237448b11bcb326c3a61339c369c9ccded5ed
2 changes: 1 addition & 1 deletion src/util/types.ts
Original file line number Diff line number Diff line change
@@ -1734,7 +1734,7 @@ export interface AriaLabelOption {
middle?: string;
end?: string;
},
excludeDataId?: number[]
excludeDimensionId?: number[]
}
}

7 changes: 4 additions & 3 deletions src/visual/aria.ts
Original file line number Diff line number Diff line change
@@ -218,13 +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 excludeDataId = labelModel.get(['data', 'excludeDataId']);
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 = !excludeDataId ? data.getValues(i)
: zrUtil.filter(data.getValues(i), (v, j) => zrUtil.indexOf(excludeDataId, j) === -1);
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, {
2 changes: 1 addition & 1 deletion 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.