我有一个饼图谁的功能现在正常工作。问题在于它的显示。当我将鼠标悬停在饼图的一个部分时,其他部分的饼图的不透明度变低。如下图所示
我的剧本在这里:
<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>
我错过了什么吗?请帮忙。提前致谢
您可以更改opacity
州的inactive
属性:
plotOptions: {
pie: {
states: {
inactive: {
opacity: 1
}
},
...
}
}
现场演示:http://jsfiddle.net/BlackLabel/05qwthgz/
API参考:https://api.highcharts.com/highcharts/series.pie.states.inactive.opacity