You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/08/13 08:54:25 UTC

[GitHub] [incubator-echarts] easonyq commented on pull request #13094: Fix legend color with customized itemStyle

easonyq commented on pull request #13094:
URL: https://github.com/apache/incubator-echarts/pull/13094#issuecomment-673353051


   Excuse me, but I cannot quite understand the **several** color that color callback returns. Is that mean the color callback within `itemStyle` of a single data serie will return different value according to different input parameters? Like this?
   
   ```javascript
   series: [{
       name: 'Forest',
       type: 'bar',
       barGap: 0,
       data: [320, 332, 301, 334, 390],
       itemStyle: {
           color: (params) => {
               if (params.someProperty)
                   return 'white'
               else 
                   return 'black';
           }
       }
   },
   ```
   
   If so, the chart will display different color for a single item. Let's take my screenshot for example, the color of *Forest* (the first bar) in 2012 (the first data) can be white, but the color of *Forest* in 2013 (the second data) can be black.
   
   If this is the case, I don't regard this as a valid configuration because the fact we take for granted that different color means different series (white stands for Forest, green stands for Wetland). If different colors exist in one data serie, it is quite wierd. (Both white and black stands for Forest??)
   
   Despite, I still think that the current situation isn't good enough, for the bar color is not consist with the legend color. I agree with @pissang that this misleading (if it really exists) is much less important than the display error happened now.


----------------------------------------------------------------
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:
users@infra.apache.org



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