-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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(legend): fix highlight state after inverseselect #11480 #11547
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,7 @@ export default echarts.extendComponentView({ | |
selectMode | ||
); | ||
|
||
itemGroup.on('click', curry(dispatchSelectAction, name, api)) | ||
itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId)) | ||
.on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId)) | ||
.on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId)); | ||
|
||
|
@@ -238,7 +238,7 @@ export default echarts.extendComponentView({ | |
); | ||
|
||
// FIXME: consider different series has items with the same name. | ||
itemGroup.on('click', curry(dispatchSelectAction, name, api)) | ||
itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId)) | ||
// Should not specify the series name, consider legend controls | ||
// more than one pie series. | ||
.on('mouseover', curry(dispatchHighlightAction, null, name, api, excludeSeriesId)) | ||
|
@@ -518,11 +518,15 @@ function setSymbolStyle(symbol, symbolType, legendModelItemStyle, borderColor, i | |
return symbol.setStyle(itemStyle); | ||
} | ||
|
||
function dispatchSelectAction(name, api) { | ||
function dispatchSelectAction(name, dataName, api, excludeSeriesId) { | ||
// downplay before unselect | ||
dispatchDownplayAction(name, dataName, api, excludeSeriesId); | ||
api.dispatchAction({ | ||
type: 'legendToggleSelect', | ||
name: name | ||
}); | ||
// highlight after select | ||
dispatchHighlightAction(name, dataName, api, excludeSeriesId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This highlight action probably is not needed. chart.dispatchAction({
type: 'legendToggleSelect',
name: 'b'
}); manually, there are still unexpected highlight state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also had concerns about this. |
||
} | ||
|
||
function dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here is "item name", but in
dispatchHighlightAction
anddispatchDownplayAction
the first parameter isseriesName
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here can be
seriesName
oritemName
. It depends on series.