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

   <!-- 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?
   
   New APIs `tooltip.nameFormatter` and `tooltip.headerFormatter` that allow 
user to change name and header respectively in tooltip are added. 
   
   
   
   ### Fixed issues
   
   - fix #16703
   
   ## Details
   
   ### Before: What was the problem?
   
   **"New formatter"** like `tooltip.valueFormatter` is requested to change the 
name and header in tooltip. With these formatters users can change only the 
series name or the header (x-axis value), without changing the other default 
parts of the tooltip.
   
   <img width="835" alt="before #16703" 
src="https://user-images.githubusercontent.com/14244944/165213836-56c0c870-8798-4d59-9c1d-75ffc7ba33ff.png";>
   Users cannot change the format of date and have to display the exact time 
despite they don't need it.
   
   
   ### After: How is it fixed in this PR?
   
   New APIs `tooltip.nameFormatter` and `tooltip.headerFormatter` are added. 
They allow user to change name and header respectively in tooltip without 
changing other default part.
   
   After setting `tooltip` to:
   ```
   tooltip: {
       trigger: 'axis',
       headerFormatter: header => `${new Date(header).toDateString()}`,
       nameFormatter: name => `Score`,
       valueFormatter: value => `${value}/10`
     }
   ```
   
   We have
   <img width="829" alt="after #16703" 
src="https://user-images.githubusercontent.com/14244944/165214464-78bc7c61-4903-405d-9245-3eccec77a41c.png";>
   User can change name and header as wish without having to write the whole 
thing from scratch with `tooltip.formatter`.
   
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [x] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   
   
   ## Others
   
   ### Merging options
   
   - [x] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to