在Highcharts的甘特图中,y轴的右对齐和居中对齐功能未正常工作。

huangapple go评论137阅读模式
英文:

Right and center alignment for yAxis not working properly in gantt chart from highcharts

问题

我想自定义y轴上的系列,使其位于右侧/左侧/中间。使用以下属性,我可以实现它:

yAxis: {
   uniqueNames: true,
   labels: {
      align: 'right', // center, left, or right
   }, 
},

但这仅适用于左对齐。对于居中和右对齐,我得到了下面的UI,您可以在图像中看到:

在Highcharts的甘特图中,y轴的右对齐和居中对齐功能未正常工作。

我是否漏掉了什么?或者这就是对齐的工作方式吗?请为这个问题建议一些修复方法。

这是我相同问题的演示代码:

演示代码链接

英文:

I want to customize series on the yAxis as right/left/center. with below property I am able to achieve it

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

  yAxis : {
       uniqueNames: true,
       labels: {
          align: &#39;right&#39;, // center, left, or right
        }, 
    },

<!-- end snippet -->

But this works fine for left alignment only. And for center and right I get this this below UI you can see in image

在Highcharts的甘特图中,y轴的右对齐和居中对齐功能未正常工作。
Am I missing anything here? or this how alignment works?
Please suggest me some fix for this issue.
Here is my demo code for the same.

https://codepen.io/manshi44/pen/KKrzOGy?editors=1111

答案1

得分: 0

这似乎是一个错误,最好在官方Highcharts存储库上报告它:https://github.com/highcharts/highcharts/issues/new/choose

然而,可以通过使用CSS来解决这个问题:

labels: {
  align: 'right',
  style: {
    transform: 'translateX(-35px)'
  }
}

解决方法演示:https://jsfiddle.net/BlackLabel/m4nhxe68/

英文:

This seems to be a bug, it would be best to report it on the official Highcharts repository: https://github.com/highcharts/highcharts/issues/new/choose

However, it is possible to work around this by moving the labels using CSS:

<!-- language: lang-js -->

labels: {
  align: &#39;right&#39;,
  style: {
  	transform: &#39;translateX(-35px)&#39;
	}
}

Workaround demo: https://jsfiddle.net/BlackLabel/m4nhxe68/

huangapple
  • 本文由 发表于 2023年7月3日 12:52:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76601913.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定