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

时间:2020-08-14 04:28:35

标签: highcharts

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

enter image description here

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

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

输出如下 enter image description here

1 个答案:

答案 0 :(得分:1)

您可以在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