Ende93 commented on issue #9940: feat(legend): add legend.color
URL: 
https://github.com/apache/incubator-echarts/pull/9940#issuecomment-467021130
 
 
   @Ovilia First, to deal with default color. Should I just check the type or 
directly get `itemModel.option.color`?
   When `option.color` is string, `data.getVisual('color')` is the same as 
`itemModel.get('color')`
   ```js
   var color = typeof itemModel.get('color') === 'string' 
       ? itemModel.get('color') 
       : data.getVisual('color')
   ```
   Second, it also can be useful when I only need to set various 
`line.lineStyle.color` and `line.ItemStyle.color`. In that case, the legend 
color will be `red`, but I want it is `blue`:
   ```
   option = {
     legend: {
       backgroundColor: "rgba(0,100,50,0.2)"
     },
     tooltip: {},
     xAxis: {
       data: seriesInfo.xAxisData
     },
     yAxis: {
       splitArea: {
         show: true
       }
     },
     series: {
       type: "line",
       name: "test",
       data: [
         {
           name: 1,
           value: 20
         },
         {
           name: 20,
           value: 30
         }
       ],
       lineStyle: {
         color: "blue"
       },
       itemStyle: {
         color: "red"
       }
     }
   };
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to