高图:将yaxis标签移动到图表的左上方

问题描述

在下面的图表中,可以将y轴标签(非洲)移动到图表的左上方。

enter image description here

xAxis: {
    categories: ['Africa'],title: {
        text: null
    }
}

https://jsfiddle.net/wanp1bqg/2/

输出如下

enter image description here

解决方法

您可以在render事件中重新定位标签,例如:

events: {
  render: function() {
    this.xAxis[0].ticks[0].label.attr({
      y: this.plotTop
    });
  }
}

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

API参考:

https://api.highcharts.com/highcharts/chart.events.render

https://api.highcharts.com/class-reference/Highcharts.SVGElement#attr