Skip to content

Commit

Permalink
Merge pull request #195 from VisActor/feat/highlight
Browse files Browse the repository at this point in the history
feat: support highlight inverse select
  • Loading branch information
neuqzxy authored Dec 26, 2024
2 parents db227eb + b485feb commit 515f13f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vstory-core",
"comment": "feat: support highlight inverse select",
"type": "none"
}
],
"packageName": "@visactor/vstory-core"
}
4 changes: 2 additions & 2 deletions packages/vstory-player/src/processor/chart/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class VChartHighlightActionProcessor extends VChartBaseActionProcessor {
}

const { payload } = actionSpec as IChartHighlightAction;
const { value, animation, style = {} } = payload as IChartHighlightPayload;
const { value, inverse, animation, style = {} } = payload as IChartHighlightPayload;
const isDatumEqual = (inputValue: any, elementDatum: any) =>
Object.keys(inputValue).every(key => inputValue[key] === elementDatum[key]);
const channel = {};
Expand All @@ -42,7 +42,7 @@ export class VChartHighlightActionProcessor extends VChartBaseActionProcessor {
},
duration: animation?.duration ?? 0
},
partitioner: datum => isDatumEqual(value, datum)
partitioner: datum => (inverse ? !isDatumEqual(value, datum) : isDatumEqual(value, datum))
});
}
});
Expand Down
1 change: 1 addition & 0 deletions packages/vstory-player/src/processor/chart/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface IChartUpdateAction extends IAction<IChartUpdatePayload> {
/************ Highlight **************/
export interface IChartHighlightPayload extends IActionPayload {
value: Datum;
inverse?: boolean;
id: string | number;
style: {
[key: string]: number | string;
Expand Down

0 comments on commit 515f13f

Please sign in to comment.