最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Highchart's Pie Chart Opacity Changes on Hover - Stack Overflow

programmeradmin0浏览0评论

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

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

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

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

Share Improve this question asked Apr 2, 2019 at 9:46 user7671954user7671954 1
  • Upvoting for that diagram. – Colin Commented Jul 30, 2020 at 15:32
Add a ment  | 

1 Answer 1

Reset to default 10

You can change the opacity property in the inactive state:

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

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

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

发布评论

评论列表(0)

  1. 暂无评论