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

5 javascript php jquery highcharts

我有一个饼图,它的功能现在工作正常。问题在于它的显示。当我将鼠标悬停在饼图的一个部分时,饼图的其他部分的不透明度变低。如下所示 在此处输入图片说明

我的脚本在这里:

<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>
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?请帮忙。提前致谢

ppo*_*zek 7

您可以更改状态中的opacity属性inactive

plotOptions: {
    pie: {
        states: {
            inactive: {
                opacity: 1
            }
        },
        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

现场演示:http : //jsfiddle.net/BlackLabel/05qwthgz/

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