Ovilia commented on issue #10505: Emphasis styles for non-active segments
URL: 
https://github.com/apache/incubator-echarts/issues/10505#issuecomment-494228241
 
 
   I created an example for you: https://jsfiddle.net/ovilia/n6xc4df3/14/
   
   ```js
   var normalStyle = {
       color: 'red'
   };
   var highlightStyle = {
       color: 'green'
   };
   var downplayStyle = {
       color: 'blue'
   };
   
   var option = {
       xAxis: {
           data: ['A', 'B', 'C', 'D', 'E']
       },
       yAxis: {},
       series: [{
           type: 'bar',
           data: [2, 20, 23, 21, 10],
           itemStyle: normalStyle
       }]
   };
   
   chart.setOption(option);
   
   chart.on('mouseover', function (param) {
       var data = option.series[0].data;
       for (var i = 0; i < data.length; ++i) {
           var style;
           if (i === param.dataIndex) {
               style = highlightStyle;
           }
           else {
               style = downplayStyle;
           }
           if (typeof data[i] === 'number') {
               data[i] = {
               value: data[i],
               itemStyle: style
               };
           }
           else {
               data[i].itemStyle = style;
           }
       }
       chart.setOption(option);
   });
   
   // change to default style
   chart.on('mouseout', function () {
       var data = option.series[0].data;
       for (var i = 0; i < data.length; ++i) {
           data[i] = {
               value: data[i].value,
               itemStyle: normalStyle
           };
       }
       chart.setOption(option);
   });
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to