pingf opened a new pull request #13366:
URL: https://github.com/apache/incubator-echarts/pull/13366


   … button for stack view
   
   <!-- Please fill in the following information to help us review your PR more 
efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   fix bug of overriding the button title of the tool box
   
   currently, if we change the title of the magic-type button in the toolbox, 
it works as expected
   however, if we click the button for stack view, all magic type buttons' 
titles revert to the default 
   our users just want a chart without chinese, I guess this is the final block!
    
   
   
   ### Fixed issues
   
   - #12979 
    
   
   
   ## Details
   
   ### Before: What was the problem?
   
   to check this one, we need do sth like this
   ```js
   toolbox: {
                  ......
                   magicType: {
                       show: true,
                       type: ['line', 'bar', 'stack'],
                       title: {
                           line: 'line view',
                           bar: 'bar view',
                           stack: 'stack view',
                           tiled: 'tiled view',
                       },
                   },
                ......
   }      
   ```
   
   as stack and tiled are sth like a pair, we need to set the title for the 
tiled
   
   but it only works if we never click the stack button,
   once we click the button for stack, all titles revert to the the default 
chinese ones
   
   
![image](https://user-images.githubusercontent.com/375315/94521504-c333cd00-0260-11eb-8bb9-e26d8a49b1cc.png)
   
   
   ### After: How is it fixed in this PR?
   
   the old code use magicTypeLang.title as the base to override the new title
   however, this is the one of fixed chinese
   
   and now I change the logic to flip the title of stack and tiled when we 
click, and use model.option to get the title dynamically
   
   ```js
   newTitle = zrUtil.merge(
               {
                         stack: model.option.title.tiled,
                         tiled: model.option.title.stack
               }, model.option.title);
   ```
   
   and now it works as expected
   
   
![image](https://user-images.githubusercontent.com/375315/94524400-21fb4580-0265-11eb-9b82-7adfdabbdd5d.png)
   
   
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   
   
   
   ### Related test cases or examples to use the new APIs
   
   NA.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### 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.

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



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

Reply via email to