[英]Data is not displayed in chartjs when using parsing: false;
我正在嘗試使用 parsing: false 顯示圖表,但數據根本沒有顯示。 該網站說這是一種內部格式,如果您禁用解析,它將起作用。
{
type: 'line',
options: {
parsing: false,
animation: false,
pointRadius: 0,
normalized: true,
spanGaps: false,
scales: {
x: {
ticks: {
source: 'auto',
// Disabled rotation for performance
// maxRotation: 0
}
}
},
},
data: {
datasets: [
{
data: [
{x: 1, y: 2},
{x: 2, y: 2},
{x: 3, y: 6},
{x: 4, y: 2},
{x: 5, y: 3},
]
}
]
},
}
使用:
"chart.js": "^4.0.1"
這是因為折線圖的內部格式 x 值是類別標度,因此您的 x 值需要是字符串而不是數字,或者您需要通過設置將其更改為線性標度: options.scales.y.type
to 'linear'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.