悬停时的Highcharts饼图不透明度变化

悬停时的Highcharts饼图不透明度变化

问题描述:

I Have a Pie Chart Whose functionality is working fine right now. The Problem is with its display.When I Hover upon the Pie Chart's one section, The other sections's opacity of the pie chart get low. As shown Below enter image description here

My Script is Here :

<script type="text/javascript">

var data = <?php echo json_encode($json_data) ?>

data.forEach(function(el) {
el.name = el.label;
el.y = Number(el.value);
});

Highcharts.chart('userpie', {
chart: {
    plotBackgroundColor: null,
    plotBorderWidth: null,
    plotShadow: false,
    type: 'pie'
},
title: {
    text: undefined
},
credits: {
  enabled: false
},
exporting: { enabled: false } ,
tooltip: {
    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
         showInLegend: true,
        dataLabels: {
            enabled: true,
            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
            style: {
                color: (Highcharts.theme && 
Highcharts.theme.contrastTextColor) || 'black'
            }
        }

    }
},
series: [{
    name: 'Users',
    colorByPoint: true,
    data: data
}]
});
</script>

Am I missing Something ?. Please Help. Thanks in Advance

You can change the opacity property in the inactive state:

plotOptions: {
    pie: {
        states: {
            inactive: {
                opacity: 1
            }
        },
        ...
    }
}

Live demo: http://jsfiddle.net/BlackLabel/05qwthgz/

API Reference: https://api.highcharts.com/highcharts/series.pie.states.inactive.opacity