Hightchart地图饼图:clic和隐藏特定饼图

时间:2018-12-11 14:35:56

标签: javascript highcharts

当我单击状态时如何隐藏状态中的特定饼? 例如在这张地图上:

https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/maps/demo/map-pies/

    series: [{
        mapData: Highcharts.maps['countries/us/us-all'],
        data: data,
        name: 'States',
        ....
        events: {
           click: function (e) {
           e.point.zoomTo();
           chart.update({
              -- hide the state's pie
              -- display data from serie on this specific state
             })
           }
        }

我想隐藏“加利福尼亚派”并放大该州以显示其他数据系列(例如,要点)...

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

您需要找到合适的系列并使用setVisible metohd:

    events: {
        click: function(e) {
            e.point.zoomTo();

            Highcharts.find(chart.series, function(item) {
                return item.name === e.point.id;
            }).setVisible(false, false);
        }
    }

实时演示:https://jsfiddle.net/BlackLabel/czav0kL3/

API:https://api.highcharts.com/class-reference/Highcharts.Series#setVisible