Skip to content

Commit

Permalink
Merge pull request #14574 from susiwen8/effectScatter-clip
Browse files Browse the repository at this point in the history
Feat(effectScatter): add clip for effectScatter
  • Loading branch information
pissang authored Apr 6, 2021
2 parents bfa1f26 + f72c9e2 commit 27c0908
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/chart/effectScatter/EffectScatterSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface EffectScatterSeriesOption extends SeriesOption<EffectScatterSta
* When to show the effect
*/
showEffectOn?: 'render' | 'emphasis'
clip?: boolean

/**
* Ripple effect config
Expand Down Expand Up @@ -107,6 +108,7 @@ class EffectScatterSeriesModel extends SeriesModel<EffectScatterSeriesOption> {

// When to show the effect, option: 'render'|'emphasis'
showEffectOn: 'render',
clip: true,

// Ripple effect config
rippleEffect: {
Expand Down
8 changes: 7 additions & 1 deletion src/chart/effectScatter/EffectScatterView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ class EffectScatterView extends ChartView {
render(seriesModel: EffectScatterSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
const data = seriesModel.getData();
const effectSymbolDraw = this._symbolDraw;
effectSymbolDraw.updateData(data);
effectSymbolDraw.updateData(data, {clipShape: this._getClipShape(seriesModel)});
this.group.add(effectSymbolDraw.group);
}

_getClipShape(seriesModel: EffectScatterSeriesModel) {
const coordSys = seriesModel.coordinateSystem;
const clipArea = coordSys && coordSys.getArea && coordSys.getArea();
return seriesModel.get('clip', true) ? clipArea : null;
}

updateTransform(seriesModel: EffectScatterSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
const data = seriesModel.getData();

Expand Down

0 comments on commit 27c0908

Please sign in to comment.