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


   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Fix the problem where itemStyle.colorAlpha does not apply to the view.
   
   ### Fixed issues
   
   - #16749
   
   ## Details
   
   ### Before: What was the problem?
   The attribute itemStyle.colorAlpha is not working to change the opacity.
   A rectangle applying `color = 'cyan'` and `colorAlpha = 0.3` has the same 
color as one applying only `'color = 'cyan'`.
   <img width="424" alt="before" 
src="https://user-images.githubusercontent.com/14244944/160345716-81a5f18d-ee56-484a-b739-8a2359146da4.png";>
   
   ### After: How is it fixed in this PR?
   
   A simple check is added to Model.ts to see if `colorAlpha` comes together 
with `color`. However this is adding details into model, which I think is not 
good. 
   The result after fix is:
   <img width="418" alt="after" 
src="https://user-images.githubusercontent.com/14244944/160344933-6b131775-8c7e-47c2-b789-a82e09f12c9e.png";>
   
   <details>
   <summary>Code to reproduce</summary>
   
   ```
   option = {
     series: [
       {
         type: 'treemap',
         label: {
           color: 'black',
         },
         data: [
           {
             name: 'nodeA',
             value: 10,
             color: ['red', 'pink'],
             children: [
               {
                 name: 'nodeAa',
                 value: 4,
                 itemStyle: {
                   color: 'cyan',
                   colorAlpha: 0.3, // not work
                 },
               },
               {
                 name: 'nodeAb',
                 value: 6,
                 itemStyle: {
                   color: 'cyan', // For Comparison
                 },
               },
             ],
           },
           {
             name: 'nodeB',
             value: 20,
             children: [
               {
                 name: 'nodeBa',
                 value: 20,
                 children: [
                   {
                     name: 'nodeBa1',
                     value: 20,
                   },
                 ],
               },
             ],
           },
         ],
       },
     ],
   };
   ```
   </details>
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [ ] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   


-- 
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-unsubscr...@echarts.apache.org

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