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 2019/05/21 03:44:30 UTC

[GitHub] [incubator-echarts] Ovilia commented on issue #10505: Emphasis styles for non-active segments

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:
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