如何在Highcharts Gantt中更改本地化的星期名称

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

How change local names for weeks in highcharts gantt

问题

我在本地化中添加了本地名称,并更改了xAxis.dateTimeLabelFormats.weeks。但是当我导航到短时间段时,它显示的是Week(而不是预期的Неделя)。

在较长的时间段上,它显示了正确的Week名称(如Неделя)。

高图版本为9.3.3。

我该如何修复这个错误?

谢谢帮助!

英文:

I added local names in locale and change xAxis.dateTimeLabelFormats.weeks. But when I navigate to short time period, it shows Week (not Неделя as expected)

如何在Highcharts Gantt中更改本地化的星期名称

On longer time period it shows right Week name (as Неделя)
如何在Highcharts Gantt中更改本地化的星期名称

  1. xAxis = {
  2. ...
  3. dateTimeLabelFormats: {
  4. hour: { list: ['%H:%M', '%H'] },
  5. day: { list: ['%A, %e. %B', '%a, %e. %b', '%E'] },
  6. week: { list: ['Неделя %W', 'Н%W', 'Н%W'] },
  7. month: { list: ['%B', '%b', '%o'] },
  8. },
  9. }

highcharts version 9.3.3

How can I fix this bug?

Thanks for help!

答案1

得分: 1

这是由于仅为一个x轴设置了dateTimeLabelFormats而导致的正确行为。根据您的要求,您需要为两个轴设置这些选项:

xAxis:[{
dateTimeLabelFormats:{
hour:{
list:['%H:%M','%H']
},
day:{
list:['%A,%e。%B','%a,%e。%b','%E']
},
week:{
list:['Неделя%W','W%W']
},
month:{
list:['%B','%b','%o']
}
},
},{
dateTimeLabelFormats:{
hour:{
list:['%H:%M','%H']
},
day:{
list:['%A,%e。%B','%a,%e。%b','%E']
},
week:{
list:['Неделя%W','W%W']
},
month:{
list:['%B','%b','%o']
}
},
}]

演示:
https://jsfiddle.net/BlackLabel/fwpusL5n/

英文:

This is the correct behavior that is caused by setting dateTimeLabelFormats only for one xAxis. In case of your requirements, you need to set theese options for both axis:

  1. xAxis:[{
  2. dateTimeLabelFormats: {
  3. hour: {
  4. list: ['%H:%M', '%H']
  5. },
  6. day: {
  7. list: ['%A, %e. %B', '%a, %e. %b', '%E']
  8. },
  9. week: {
  10. list: ['Неделя %W', 'W%W']
  11. },
  12. month: {
  13. list: ['%B', '%b', '%o']
  14. }
  15. },
  16. },{
  17. dateTimeLabelFormats: {
  18. hour: {
  19. list: ['%H:%M', '%H']
  20. },
  21. day: {
  22. list: ['%A, %e. %B', '%a, %e. %b', '%E']
  23. },
  24. week: {
  25. list: ['Неделя %W', 'W%W']
  26. },
  27. month: {
  28. list: ['%B', '%b', '%o']
  29. }
  30. },
  31. }],

Demo:
https://jsfiddle.net/BlackLabel/fwpusL5n/

huangapple
  • 本文由 发表于 2023年8月11日 15:26:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76881482.html
匿名

发表评论

匿名网友

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

确定