-
Notifications
You must be signed in to change notification settings - Fork 19.8k
feat(line): add triggerEvent option for more control over mouse event
#21001
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f5534bb
feat(line): triggerAreaEvent option for more control over mouse event
sjcobb f95af4c
Rename option to triggerLineOnlyEvent
sjcobb dea397d
change line series option to triggerEvent, deprecate triggerLineEvent
sjcobb 61afd73
feat(line): 1) add `selfType` property into line/area trigger event f…
plainheart 3a39f66
Merge remote-tracking branch 'remotes/upstream/master' into fix-21000…
plainheart 27d3dbc
test(line): add VRT test case
plainheart 68a151a
fix(line): tweak logic
plainheart 5a575c9
fix(line): tweak deprecation tip
plainheart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
To be honest,
triggerLineOnlyEventis more confusing. I don't know what it means until I see this comment. If we want to refine thetriggerEventbehavior to split it into the line event and area event, I would suggest introducing a new optiontriggerEvent- thetriggerEventoption is used repeatedly. For instance,title.triggerEvent,xAxis.triggerEvent, etc.So I think we can merge both options into a single option
triggerEventwith the boolean type and constant string'line'/'area'allowed.For backward compatibility, the new option
triggerEventshould work with both line and area unless it is explicitly specified to a single target.The changes look like this,
src/chart/line/LineSeries.ts
src/chart/line/LineView.ts
Note that
triggerLineEventhas higher priority thantriggerEventfor compatibility.But
triggerEventdoes not control whether to trigger the symbol event, which is triggered by default. This may be a confusing point, so it's better to add some explanation. I would like to hear what you think about this.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.
I agree that
triggerEventis a better idea thantriggerLineOnlyEvent. It would also be nice to have a feature that developers can decide whether to blur other series when hovering on the line or the line area. Would thistriggerEventalso be helpful if we decide to implement such a feature in the future?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.
It sounds like
emphasis.disabledcan do that.Uh oh!
There was an error while loading. Please reload this page.
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.
This makes sense, I made the change to support
triggerEventand deprecatetriggerLineEvent. As far as more control over symbol event, for my use case it's not required. When symbols are visible, we always want the event to fire (and theshowSymbol,showAllSymboloptions give enough flexibility already).Also not a strong opinion since it would be a breaking change but given that v6.0 is about to release, would it make sense for
triggerEvent: 'line'ortriggerEvent: trueto be the default instead oftriggerEvent: false?