我可以在悬停时将 highcharts 列堆叠起来而不突出显示整个系列吗

Sil*_*van 4 html javascript css jquery highcharts

正如你在这里看到的jsfiddle。如果我将highcharts 列column: {stacking: 'normal'}.

当您将鼠标悬停在其上时,它会突出显示具有相同名称的整个系列。

有没有什么方法可以让我只突出显示悬停的元素,而不以任何方式影响该系列中的其他元素?我还想保留悬停标签。

Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    title: {
        text: 'Stacked column chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
            }
        }
    },
    legend: {
        align: 'right',
        x: -30,
        verticalAlign: 'top',
        y: 25,
        floating: true,
        backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        headerFormat: '<b>{point.x}</b><br/>',
        pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true,
                color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
            }
        }
    },
    series: [{
        name: 'John',
        data: [5, 3, 4, 7, 2]
    }, {
        name: 'Jane',
        data: [2, 2, 3, 2, 1]
    }, {
        name: 'Joe',
        data: [3, 4, 4, 2, 5]
    }]
});
Run Code Online (Sandbox Code Playgroud)
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
Run Code Online (Sandbox Code Playgroud)

ppo*_*zek 5

您可以禁用该inactive效果并使用hover状态:

plotOptions: {
    ...,
    column: {
        stacking: 'normal',
        states: {
            inactive: {
                enabled: false
            },
            hover: {
                color: 'blue'
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

现场演示: https: //jsfiddle.net/BlackLabel/Lg796ha3/

API 参考: https://api.highcharts.com/highcharts/series.column.states.hover.color