You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/10/12 03:06:43 UTC

[GitHub] Ovilia commented on issue #9201: 柱状图一组数据(根据正负值)显示在同一水平线上不同颜色(显示同一方向)

Ovilia commented on issue #9201: 柱状图一组数据(根据正负值)显示在同一水平线上不同颜色(显示同一方向)
URL: https://github.com/apache/incubator-echarts/issues/9201#issuecomment-429189397
 
 
   ```js
   var data = [12, 22, -10, -5, 11, 31];
   
   var displayData = data.map(v => Math.abs(v));
   
   option = {
       xAxis: {
           data: ['a', 'b', 'c', 'd', 'e', 'f']
       },
       yAxis: {
           
       },
       series: {
           name: 'aa',
           type: 'bar',
           data: displayData,
           itemStyle: {
               color: function(p) {console.log(p)
                   return data[p.dataIndex] > 0 ? '#eb3d42' : '#00802d';
               }
           }
       }
   }
   ```

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


With regards,
Apache Git Services

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