Adelaide1014 commented on issue #4667: 如何在柱状图给最大值和最小值设置不同的颜色
URL: 
https://github.com/apache/incubator-echarts/issues/4667#issuecomment-379530823
 
 
   ECharts version [ECharts 版本]: 3.0版本中:
   <pre>            itemStyle:{
                   normal:{
                       color:'orange' 
                   },
                   emphasis:{
                       color:'purple' 
                   }
               },</pre>
   是用来设置正常显示与鼠标悬停等高亮时的状态,不是用来设置最大值最小值是的颜色;
   解决方案如下
   
   <pre>
   function getColor(value){
       console.log(value)
       if(value=='max'){
           return 'red';
       }else{
           return 'green';
       }
   }
   
       series : [
           {
               name:'直接访问',
               type:'bar',
               barWidth: '60%',
               itemStyle:{
                   normal:{//正常
                       color:'orange' 
                   },
                   emphasis:{//高亮鼠标悬浮
                       color:'purple' 
                   }
               },
               data:[{
                   value:10,
                   itemStyle:{//直接专递是否最大值
                    color:getColor('min')
                     
                   }
               }, {
                   value:52,
                   itemStyle:{
                         color:getColor('max')
                   }
               }, {
                   value:22,
                   itemStyle:{
                         //color:getColor('max')
                   }
               }]
           }
       ]
   </pre>

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


With regards,
Apache Git Services

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

Reply via email to