繁体   English   中英

如何在 Highcharts 中居中 yAxis 标题

[英]How to center the yAxis title in Highcharts

当 yAxis 标题显示在 Highcharts 中的 yAxis 顶部时,有什么方法可以使 yAxis 标题居中? 这是一个后续问题 还没有找到解决办法。

这就是它此刻的样子:

在此处输入图片说明

yAxis: {
  title: {
    text: "Cumulative mean<br />annual mass balance<br />(mm w.e.)",
    align: "high",
    rotation: 0,
    x: 180,
    y: -30,
    useHTML: true,
    style: {
      align: "center",
      fontWeight: "bold"
    }
  },

我想让这三个居中。 尝试使用 useHTML 并对齐。 但不起作用...

这是一个小提琴

感谢您的任何提示。

你可以在 CSS 中做到这一点。

要使 y 轴水平居中,请添加这些样式,并删除 x 值:

.highcharts-axis {
  position: relative;
  left: 50% !important;
  transform: translateX(-50%);
}

要居中对齐其文本,请使用以下样式:

.highcharts-axis {
  text-align: center;
}

更新的小提琴

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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