我正在使用 Chart.js 根据本地托管的 mysql 数据库中的数据创建折线图。
我能够提取这些数据并按预期显示它,但是尽管遵循其他给出的文档和建议,我无法隐藏 xAxis 标签。我正在使用的代码如下 - 任何帮助将非常感激。
var chardata = {
labels: time,
datasets: [
{
label: "System health",
fill: false,
backgroundColor: "rgba(123, 192, 67, 0.75)",
borderColor: "rgba(123, 192, 67, 1)",
pointHoverBackgroundColor: "rgba(123, 192, 67, 1)",
pointHoverBorderColor: "rgba(123, 192, 67, 1)",
data: health_score
}
]
};
var ctx = $("#mycanvas");
var options = {
type: 'line',
data: chardata,
options: {
scales: {
xAxes: [{
ticks: {
display: false
}
}]
}
}
};
var LineGraph = new Chart(ctx, options);
干杯
最佳答案
..
var options = {
type: 'line',
data: chardata,
options: {
scales: {
xAxes: [{
display: false,
ticks: {
display: false
}
}]
}
}
};
..
关于javascript - 使用 Chart.js 时隐藏 xAxis 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61116388/