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 : select series for grouped (fix #565) #582

Merged
merged 1 commit into from Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/chart/src/component/lineSeries.ts
Expand Up @@ -255,7 +255,7 @@ export default class LineSeries extends Component {
this.rect.width,
getCoordinateXValue(datum as CoordinateDataType),
getCoordinateDataIndex(datum, categories, idx, this.startIndex),
xAxisLimit,
xAxisLimit
);
points.push({ x, y, value });
});
Expand Down
6 changes: 4 additions & 2 deletions apps/chart/src/component/selectedSeries.ts
Expand Up @@ -20,6 +20,8 @@ type ActiveSeriesNames = { [key in TooltipModelName]: string[] };
export default class SelectedSeries extends Component {
models: ResponderSeriesModel = {} as ResponderSeriesModel;

seriesModels: ResponderSeriesModel = {} as ResponderSeriesModel;

activeSeriesNames: ActiveSeriesNames = {} as ActiveSeriesNames;

isShow = false;
Expand Down Expand Up @@ -101,11 +103,11 @@ export default class SelectedSeries extends Component {
})
? []
: models;

this.seriesModels[alias || name] = this.getSelectedSeriesModels(selectedSeriesEventModel);
this.isShow = !!Object.values(this.models).flatMap((value) => value).length;
this.eventBus.emit(
this.isShow ? 'selectSeries' : 'unselectSeries',
makeObservableObjectToNormal(this.getSelectedSeriesModels(selectedSeriesEventModel))
makeObservableObjectToNormal(this.seriesModels)
);
this.activeSeriesNames[name] = this.getSeriesNames(selectedSeriesEventModel.models, name);
this.setActiveState();
Expand Down