带有本地日期的 chartjs
chartjs with local dates
我当前图表中 xAxis 中的刻度格式正确,但语言错误。例如:“7 月 22 日 21:00”
我希望它们像 "22 Heinäkuuta 21:00" 一样本地化,但是“语言环境 属性”似乎没有任何改变.我做错了吗?
var config = { // my chart config
type: 'line',
data: { datasets: [] },
options: {
parsing: false,
normalized: true,
animation: false,
locale: "fi-FI", // my locale
scales: {
xAxis: {
type: 'time',
time: {
source: 'auto',
minUnit: 'hour',
displayFormats: {
minute: "dd MMMM HH:mm",
hour: "dd MMMM HH:mm",
day: "dd MMMM",
week: "dd MMMM",
month: "MMMM",
quarter: 'MMMM yyyy',
year: "yyyy",
}
}
},
},
}
}
我已经阅读了我能找到的所有文档。但我无法理解这个 locale documentation
我需要为我的 日期库 提供区域设置,对我来说 Luxon:
luxon.Settings.defaultLocale = "fi";
Moment 以类似的方式进行,但我还没有测试过:
moment.locale("fi");
我当前图表中 xAxis 中的刻度格式正确,但语言错误。例如:“7 月 22 日 21:00”
我希望它们像 "22 Heinäkuuta 21:00" 一样本地化,但是“语言环境 属性”似乎没有任何改变.我做错了吗?
var config = { // my chart config
type: 'line',
data: { datasets: [] },
options: {
parsing: false,
normalized: true,
animation: false,
locale: "fi-FI", // my locale
scales: {
xAxis: {
type: 'time',
time: {
source: 'auto',
minUnit: 'hour',
displayFormats: {
minute: "dd MMMM HH:mm",
hour: "dd MMMM HH:mm",
day: "dd MMMM",
week: "dd MMMM",
month: "MMMM",
quarter: 'MMMM yyyy',
year: "yyyy",
}
}
},
},
}
}
我已经阅读了我能找到的所有文档。但我无法理解这个 locale documentation
我需要为我的 日期库 提供区域设置,对我来说 Luxon:
luxon.Settings.defaultLocale = "fi";
Moment 以类似的方式进行,但我还没有测试过:
moment.locale("fi");