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

fix decal in aria #19172

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions src/chart/sunburst/SunburstSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
import GlobalModel from '../../model/Global';
import SeriesData from '../../data/SeriesData';
import Model from '../../model/Model';
import enableAriaDecalForTree from '../helper/enableAriaDecalForTree';

interface SunburstItemStyleOption<TCbParams = never> extends ItemStyleOption<TCbParams> {
// can be 10
Expand Down Expand Up @@ -164,7 +163,6 @@ class SunburstSeriesModel extends SeriesModel<SunburstSeriesOption> {
static readonly type = 'series.sunburst';
readonly type = SunburstSeriesModel.type;

ignoreStyleOnData = true;

private _viewRoot: TreeNode;
private _levelModels: Model<SunburstSeriesLevelOption>[];
Expand Down Expand Up @@ -312,9 +310,6 @@ class SunburstSeriesModel extends SeriesModel<SunburstSeriesOption> {
}
}

enableAriaDecal() {
enableAriaDecalForTree(this);
}
}


Expand Down
30 changes: 20 additions & 10 deletions src/data/SeriesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ class SeriesData<

const dimensionInfo: SeriesDimensionDefine =
zrUtil.isString(dimInfoInput)
? new SeriesDimensionDefine({name: dimInfoInput})
: !(dimInfoInput instanceof SeriesDimensionDefine)
? new SeriesDimensionDefine(dimInfoInput)
: dimInfoInput;
? new SeriesDimensionDefine({name: dimInfoInput})
: !(dimInfoInput instanceof SeriesDimensionDefine)
? new SeriesDimensionDefine(dimInfoInput)
: dimInfoInput;

const dimensionName = dimensionInfo.name;
dimensionInfo.type = dimensionInfo.type || 'float';
Expand Down Expand Up @@ -406,8 +406,8 @@ class SeriesData<
return dimInfo
? dimInfo.storeDimIndex
: this._dimOmitted
? this._schema.getSourceDimensionIndex(dim as DimensionName)
: -1;
? this._schema.getSourceDimensionIndex(dim as DimensionName)
: -1;
}

/**
Expand Down Expand Up @@ -1124,8 +1124,8 @@ class SeriesData<
*/
// TODO: Type of data item
getItemModel<ItemOpts extends unknown = unknown>(idx: number): Model<ItemOpts
// Extract item option with value key. FIXME will cause incompatible issue
// Extract<HostModel['option']['data'][number], { value?: any }>
// Extract item option with value key. FIXME will cause incompatible issue
// Extract<HostModel['option']['data'][number], { value?: any }>
> {
const hostModel = this.hostModel;
const dataItem = this.getRawDataItem(idx) as ModelOption;
Expand Down Expand Up @@ -1184,8 +1184,18 @@ class SeriesData<
*/
// eslint-disable-next-line
getItemVisual<K extends keyof Visual>(idx: number, key: K): Visual[K] {
const itemVisual = this._itemVisuals[idx] as Visual;
const val = itemVisual && itemVisual[key];
let itemVisual = this._itemVisuals[idx] as Visual;

let val = itemVisual && itemVisual[key];
if (this.tree && !val) {
let current = this.tree.getNodeByDataIndex(idx);

while (current && current.depth > 1 && !val) {
current = current.parentNode;
itemVisual = this._itemVisuals[current.dataIndex] as Visual;
val = itemVisual && itemVisual[key];
}
}
if (val == null) {
// Use global visual property
return this.getVisual(key);
Expand Down
1 change: 0 additions & 1 deletion src/visual/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
}
if (zrUtil.isFunction(seriesModel.enableAriaDecal)) {
// Let series define how to use decal palette on data
seriesModel.enableAriaDecal();
return;
}

Expand Down
172 changes: 172 additions & 0 deletions test/sunburst-ariaDecal.html

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