简体   繁体   中英

problem Highchart Show/Hide data label on hover legend

This sample for Highchart show/hide data label by mouseover on depended legend series;

 plotOptions: {
        series: {
            dataLabels: {
                enabled: true
            },
            events: {
                mouseOver: function(event) {
                    $.each(this.data, function(i, point){
                        point.dataLabel.show();
                    });
                },
                mouseOut: function(event) {
                    $.each(this.data, function(i, point){
                        point.dataLabel.hide();
                    });
                }
            }
        }
    },

But it is difficult to display numbers in common places.

How to resolve this??

Thanks in advance.

Sample: JSFiddle

You need to enable the allowOverlap option for data labels:

plotOptions: {
  series: {
    dataLabels: {
      enabled: true,
      allowOverlap: true
    },
    ...
  }
}

Live demo: http://jsfiddle.net/BlackLabel/72r5kfcn/

API Reference: https://api.highcharts.com/highcharts/series.line.dataLabels.allowOverlap

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM