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

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

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中更改本地化的星期名称

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'] },
    },
}

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:

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']
            }
        },
}],

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:

确定