You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "MrSquaare (via GitHub)" <gi...@apache.org> on 2023/06/05 10:08:11 UTC

[GitHub] [echarts] MrSquaare opened a new pull request, #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates

MrSquaare opened a new pull request, #18715:
URL: https://github.com/apache/echarts/pull/18715

   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   Adds tooltip position as `tooltip.formatter` argument and injects graphic element's point coordinates into `CallbackDataParams`.
   
   
   ### Fixed issues
   
   - #14774: Will help to resolve this issue
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   It was not possible to format the tooltip based on its position relative to the points.
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ### After: How does it behave after the fixing?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   The user can use the tooltip's `position` argument and the point coordinates in the `params` argument of `tooltip.formatter` to customize the tooltip display.
   For example: Highlight nearest serie in tooltip, displays only the nearest point in the tooltip.
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ## Document Info
   
   One of the following should be checked.
   
   - [ ] This PR doesn't relate to document changes
   - [x] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   
   
   ## Misc
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   - `tooltip-formatter` test case
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   
   **IMPORTANT NOTE**: I retrieved the coordinates from the graphic element of the data, but I'm not sure this is the right way to proceed. I'd be pleased to receive feedback on this.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] Ovilia commented on pull request #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-1588626789

   If you want to provide the position, I think it may be a better idea to be the position of the mouse position relative to the canvas top-left corder. Your current code seems to return the `x` and `y` of the interacted element, which may not be necessarily be the top-left of the interacted element because it's used for transforming.
   
   Element states are defined in https://github.com/apache/echarts/blob/master/src/util/types.ts#L650 
   
   Please also simplify your test case data and remove the unnecessary data.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [PR] feat(tooltip): inject tooltip position in formatter and data params's point coordinates [echarts]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-3172098642

   This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR. We are sorry for this but 2 years is a long time and the code base has been changed a lot. Thanks for your contribution anyway.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [PR] feat(tooltip): inject tooltip position in formatter and data params's point coordinates [echarts]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates
URL: https://github.com/apache/echarts/pull/18715


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [PR] feat(tooltip): inject tooltip position in formatter and data params's point coordinates [echarts]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-3194651124

   This PR has been automatically closed because it has not had recent activity. Sorry for that and we are looking forward to your next contribution.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] MrSquaare commented on pull request #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates

Posted by "MrSquaare (via GitHub)" <gi...@apache.org>.
MrSquaare commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-1591567796

   @Ovilia The mouse position is already provided as a fourth parameter of `tooltip.formatter` (sadly this function already takes 3 non-named parameter, maybe should I return the position as a named parameter for future API changes?)
   `param.x` and `param.y` are the position of the element (I suppose the top left position of the element)
   From my tests, I deduced that these position were the element position relative to the top left canvas position (e.g.: setting absolute position to the canvas, seeing that `x` and `y` are not related to the canvas's DOM position). I can't be 100% sure that this is always the case (perhaps there are other transformations applied with certain options); No definition is provided for these two `ZRender.Element` properties (in the code or in the [ZRender documentation](https://ecomfe.github.io/zrender-doc/public/api.html)).
   
   For the element states, I'm not sure if this is something I have to calculate (how?) or if this is something I can already get; currently, from what I see after a code search, `DisplayState` is mainly used for labels, and the state is provided via a callback to the label options.
   I also see that `ECElement` has two states that correspond to `DisplayState`: `ECElement.hoverState` and `ECElement.selected`;
   `ECElement` also has an `applyElementStates` method for adding states to the `ZRender` element. Isn't this done after `TooltipView` calls `getDataParams`? This would mean that it would be impossible for me, without changing the order of proceedings, to retrieve these states.
   Note that all this may be a confusion on my part and be two separate things.
   
   To conclude, I'm new to the codebase, I'd like to do my best, but I don't know where to find the resources to help me.
   In fact, if retrieving the states requires kind of major changes to the codebase, I won't be able to make them. However, I'd be interested in following the development.
   
   > Does this kind of discussion have to take place as comments on this PR, or does echarts have specific message channels that I can use?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] echarts-bot[bot] commented on pull request #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-1576508687

   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
   
   Document changes are required in this PR. Please also make a PR to [apache/echarts-doc](https://github.com/apache/echarts-doc) for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the `PR: awaiting doc` label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] MrSquaare commented on pull request #18715: feat(tooltip): inject tooltip position in formatter and data params's point coordinates

Posted by "MrSquaare (via GitHub)" <gi...@apache.org>.
MrSquaare commented on PR #18715:
URL: https://github.com/apache/echarts/pull/18715#issuecomment-1582166534

   @Ovilia In fact, it would be more user-friendly to provide state to the user (can you define each of the state you've given me as examples?).
   I still think we should return the positions to allows users to handle more complex cases (e.g. I want to display the 3 points closest to my cursor, I want to display the points within a radius, etc.)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org